Inline functions

June 10, 2019 ยท View on GitHub

The following functions are currently supported:

FunctionParametersDescription
entidSnapshot Reference, identReturns the entity id associated with a symbolic keyword, or the id itself if passed.
latestTConnection ReferenceReturns the latest tx-num that the Connection has updated its local state to match.
queryquery, inputsReturns the result of a query.
firstcollectionReturns the first element in the collection.

If there is a need for a new inline function, add it according to the creating inline functions documentation.

entid Example

#eva.client.service/inline {
    :fn entid
    :params [
        #eva.client.service/snapshot-ref ["test-label"]
        [:something/tx-metadata "hello"]
    ]
}

latestT Example

#eva.client.service/inline {
    :fn latestT
    :params [
        #eva.client.service/connection-ref { :label "test-label" } 
        :martin/tx-metadata "hello"]]
}

query Example

#eva.client.service/inline {
    :fn query
    :params [
        "[:find ?tx :in $ ?t :where [?b :book/title ?t ?tx]]"
        [
            #eva.client.service/snapshot-ref [
                "{{label}}"]
            "\"First Book\""
        ]
    ]
}

first Example

#eva.client.service/inline { :fn first :params [1 2 3] }