Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Latest commit

 

History

History
57 lines (46 loc) · 1.42 KB

inline-functions.md

File metadata and controls

57 lines (46 loc) · 1.42 KB

Inline functions

The following functions are currently supported:

Function Parameters Description
entid Snapshot Reference, ident Returns the entity id associated with a symbolic keyword, or the id itself if passed.
latestT Connection Reference Returns the latest tx-num that the Connection has updated its local state to match.
query query, inputs Returns the result of a query.
first collection Returns 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] }