A collection of functions and macros used to help building SEQL schemas conforming to the spec provided in :seql.core/schema
A collection of functions and macros used to help building SEQL schemas conforming to the spec provided in :seql.core/schema
(add-create-mutation)
(add-create-mutation create-kw)
Add a mutation to insert a new record in the database.
By default the mutation will be named create
in the
corresponding's entity namespace.
The mutation needs a spec of its input.
Add a mutation to insert a new record in the database. By default the mutation will be named `create` in the corresponding's entity namespace. The mutation needs a spec of its input.
(add-delete-by-id-mutation ident)
(add-delete-by-id-mutation ident delete-kw)
Add a delete mutation to delete a record by ID in the database.
Needs an identifier field ident
, which will be used to specify
the mutation target.
By default the mutation will be named delete
in the
corresponding's entity namespace. The ident specified
should be provided in the input map parameters.
The mutation needs a spec of its input.
Add a delete mutation to delete a record by ID in the database. Needs an identifier field `ident`, which will be used to specify the mutation target. By default the mutation will be named `delete` in the corresponding's entity namespace. The ident specified should be provided in the input map parameters. The mutation needs a spec of its input.
(add-precondition kw precondition-key handler)
(add-precondition kw precondition-key handler valid-fn)
Adds the precondition function handler
to the
mutation named kw
, when ran, the mutation will
provide back its identifier precondition-key
.
Takes an optional valid-fn
validation function which
is used to assert the success of the precondition, defaults
to clojure.core/seq
.
Precondition functions must return a form ready for
honey.sql/format
or will throw.
Adds the precondition function `handler` to the mutation named `kw`, when ran, the mutation will provide back its identifier `precondition-key`. Takes an optional `valid-fn` validation function which is used to assert the success of the precondition, defaults to `clojure.core/seq`. Precondition functions **must** return a form ready for `honey.sql/format` or will throw.
(add-update-by-id-mutation ident)
(add-update-by-id-mutation ident update-kw)
Add an update mutation to modify a record in the database.
Needs an identifier field ident
, which will be used to
specify the target.
By default the mutation will be named update
in the
corresponding's entity namespace. The ident specified
should be provided in the input map parameters.
The mutation needs a spec of its input.
Add an update mutation to modify a record in the database. Needs an identifier field `ident`, which will be used to specify the target. By default the mutation will be named `update` in the corresponding's entity namespace. The ident specified should be provided in the input map parameters. The mutation needs a spec of its input.
(column-name field colname)
Overrides the column name for a column, will bypass name transforms through
camel-snake-kebab
Overrides the column name for a column, will bypass name transforms through `camel-snake-kebab`
(condition field)
(condition field from-field)
(condition field from-field value)
Build a condition which can be used to filter results at the database layer.
With a single arg, builds a condition bearing the name of a field to test pure equality.
With two args, builds a condition testing equality against the provided field name.
With three args, tests a field name against a provided value.
Build a condition which can be used to filter results at the database layer. With a single arg, builds a condition bearing the name of a field to test pure equality. With two args, builds a condition testing equality against the provided field name. With three args, tests a field name against a provided value.
(entity arg & components)
Provide an entity description. Expects either a keyword or a tuple
of [entity-name table-name]
and a list of details as expressed by
field
, has-many
, condition
, and mutation
Provide an entity description. Expects either a keyword or a tuple of `[entity-name table-name]` and a list of details as expressed by `field`, `has-many`, `condition`, and `mutation`
(entity-from-spec arg & components)
Infer entity description from an s/keys
spec. The related spec should only
contain concrete fields and no relations.
Infer entity description from an `s/keys` spec. The related spec should only contain concrete fields and no relations.
(has-many field [local remote])
Express a one to many relation between the current entity and a remote one, expects a tuple of local ID to (qualified) remote ID.
Express a one to many relation between the current entity and a remote one, expects a tuple of local ID to (qualified) remote ID.
(has-many-through field [local left right remote])
Express a many to many relation between the current entity and a remote one through an intermediate table. Expects a tuple of local ID, reference to that ID in the intermediate table, second join field in the intermediate table, and qualified remote ID.
Express a many to many relation between the current entity and a remote one through an intermediate table. Expects a tuple of local ID, reference to that ID in the intermediate table, second join field in the intermediate table, and qualified remote ID.
(has-one field [local remote])
Express a one to one relation between the current entity and a remote one, expects a tuple of local ID to (qualified) remote ID.
Express a one to one relation between the current entity and a remote one, expects a tuple of local ID to (qualified) remote ID.
(ident)
Marks the current field as ident, used inside field definitions
Marks the current field as ident, used inside field definitions
(inline-condition field args & body)
Provide a function tail which shall yield a honeysql fragment to express a where condition on a field.
Provide a function tail which shall yield a honeysql fragment to express a where condition on a field.
(make-schema & entities)
Provide a complete schema of entites
Provide a complete schema of entites
(mutation mutation-name spec bindv & body)
Provide a function tail to perform a mutation against an entity
Provide a function tail to perform a mutation against an entity
(mutation-fn mutation-name spec handler)
Provide a function to perform a named mutation.
Provide a function to perform a named mutation.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close