Define domain types
Define domain types
(defentity ent-name fields primary & more)
Define a record type with fields, keys and any additional information
Define a record type with fields, keys and any additional information
(defenum name symsvals default)
Define an enum type, mapping keywords to values, for example
(defenum :foo/Active {:y 1 :n 0} :y)
defines the enum :foo/Active with two keyword symbols and corresponding values, and whose default is :y
Define an enum type, mapping keywords to values, for example (defenum :foo/Active {:y 1 :n 0} :y) defines the enum :foo/Active with two keyword symbols and corresponding values, and whose default is :y
(defscalar name val)
Define a scalar type, for example:
(defscalar :foo/Money 0.00M
defines the type :foo/Money as a big decimal with 2 decimal places of accuracy.
Define a scalar type, for example: (defscalar :foo/Money 0.00M defines the type :foo/Money as a big decimal with 2 decimal places of accuracy.
(delete-instance instance)
Delete the given entity instance from its persistent storage.
Delete the given entity instance from its persistent storage.
(entity-instance? arg entity)
Returns true if the argument is an instance of the given entity. The entity can be a keyword (a literal referral to the domain type) or an instance (from which the type will be determined). If arg is not an instance of entity, returns false.
Returns true if the argument is an instance of the given entity. The entity can be a keyword (a literal referral to the domain type) or an instance (from which the type will be determined). If arg is not an instance of entity, returns false.
(enum-sym enum val)
Return the symbol for a given domain enum type and value
Return the symbol for a given domain enum type and value
(enum-val enum sym)
Return the value for the given domain enum type and symbol
Return the value for the given domain enum type and symbol
(enum-val-fn enum sym)
Return the value for the given domain enum type and symbol
Return the value for the given domain enum type and symbol
(find-entity entity)
Find the type from the given keyword ref
Find the type from the given keyword ref
(find-value scalar)
(find-value entity field)
Find a value from the types catalog. Two args means type:field. Single arg means scalar. If type:field does not resolve then field is considered a key name, returning the key proto if found.
Find a value from the types catalog. Two args means type:field. Single arg means scalar. If type:field does not resolve then field is considered a key name, returning the key proto if found.
(get-alias instance)
Return a keyword that can be used to associate the instance in a map. This will be either its unqualified name or any alias that was specified when defined.
Return a keyword that can be used to associate the instance in a map. This will be either its unqualified name or any alias that was specified when defined.
(get-create-fn instance)
Return the function that can be called to correctly initialise this and anything other required in the domain.
Return the function that can be called to correctly initialise this and anything other required in the domain.
(get-destroy-fn instance)
Return the function that can be called to destroy this and anything else required in the domain.
Return the function that can be called to destroy this and anything else required in the domain.
(get-mutate-fn instance)
Return the function that can be called to verify what changes are allowed and perform any consequential actions in the domain.
Return the function that can be called to verify what changes are allowed and perform any consequential actions in the domain.
(get-primary-key instance)
Return the instance's primary key from its meta data. If not found, throws, if identifiable as the primary key itself then returns the argument
Return the instance's primary key from its meta data. If not found, throws, if identifiable as the primary key itself then returns the argument
(key-val? arg)
Returns true if the argument appears to be a value returned by make-key
Returns true if the argument appears to be a value returned by make-key
(make-key key-val entity key-name)
Make a key value. Returns a map comprising only the map keys for the given domain key name. Any missing fields are nil (or explicit default value); additional fields are ignored.
Make a key value. Returns a map comprising only the map keys for the given domain key name. Any missing fields are nil (or explicit default value); additional fields are ignored.
(new-instance entity)
(new-instance entity ent-val)
Make an instance of the specified type, setting any fields when an initial value is given. Any missing fields remain their default values; additional fields are ignored.
Make an instance of the specified type, setting any fields when an initial value is given. Any missing fields remain their default values; additional fields are ignored.
(primary-key-to-meta instance)
Augment the instance meta data with the primary key. This can only be done when the primary key is established, but it is trusted this is so
Augment the instance meta data with the primary key. This can only be done when the primary key is established, but it is trusted this is so
(read-entity key-val)
(read-entity entity-name key-val)
(read-entity key-val entity-name key-name)
Read the given entity, applying the key value
Read the given entity, applying the key value
(write-instance instance)
Write the given entity instance to its persistent storage
Write the given entity instance to its persistent storage
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close