(alias-column table-name column)
Returns a column alias from a table and column name, for deterministic control of query results.
Returns a column alias from a table and column name, for deterministic control of query results.
(aliased-fields-statement alias-map)
Takes a map of :aliased-query-column-name
to :table/column
and
returns a SQL fields statement, eg "SELECT <fields> FROM ..."
Takes a map of `:aliased-query-column-name` to `:table/column` and returns a SQL fields statement, eg "SELECT <fields> FROM ..."
(column-mappings table)
Returns a map of :aliased-query-column-name
to :table/column
from a table spec.
Returns a map of `:aliased-query-column-name` to `:table/column` from a table spec.
(column-name kw)
Returns the column name from a keyword.
Returns the column name from a keyword.
(condition-sql condition)
(condition-sql condition table-alias)
Takes a condition map, and optional table alias for the column's table, and returns a SQL condition string fragment. Default comparator is "=".
Eg, {:column :foo/bar :comparator ">" :value 5}
Becomes "foo.bar > 5"
Takes a condition map, and optional table alias for the column's table, and returns a SQL condition string fragment. Default comparator is "=". Eg, `{:column :foo/bar :comparator ">" :value 5}` Becomes "foo.bar > 5"
(dependency-ordered root-table rels)
Takes a collection of relationships and the root table, and returns the relationships in a dependency-satisfied order.
Takes a collection of relationships and the root table, and returns the relationships in a dependency-satisfied order.
(field-column field)
Returns column name from a field as string.
Returns column name from a field as string.
(from-statement table)
(from-statement table recurse?)
Builds a from statement from table spec. Optionally, recurses through the many relationships and adds them to the statement.
Builds a from statement from table spec. Optionally, recurses through the many relationships and adds them to the statement.
(group-column-mappings table)
Returns a map of :aliased-query-column
to :table/column
for all
the columns in a table spec's query group (itself and its single
relationships.)
Returns a map of `:aliased-query-column` to `:table/column` for all the columns in a table spec's query group (itself and its single relationships.)
(in-statement {:keys [field vals] :as in})
Returns an IN statement that can be used in a WHERE clause to match a column against a set of values.
Returns an IN statement that can be used in a WHERE clause to match a column against a set of values.
(inner-join-sql join)
Takes a join map and returns SQL fragment for an inner join. Join map has :base and :target keys, each of which are maps of:
Takes a join map and returns SQL fragment for an inner join. Join map has :base and :target keys, each of which are maps of: * :name table name string * :alias optional table alias string * :join-col string name of the join column
(many-relationship-select rel data)
Takes a many relationship and data returned from the parent query and builds a query to select the many relationship data. Returns tuple of [sql-query column-alias-map].
Takes a many relationship and data returned from the parent query and builds a query to select the many relationship data. Returns tuple of [sql-query column-alias-map].
(mysql-date-string date)
Takes a date coerceable to LocalDateTime, and returns mysql-formatted date time string.
Takes a date coerceable to LocalDateTime, and returns mysql-formatted date time string.
(prefixed-column table column)
Returns a prefixed column from a table name and column name, for use in SQL statements.
Returns a prefixed column from a table name and column name, for use in SQL statements.
(select table)
Builds select statement from table. Optionally, brings in levels of many relationships in the from statement to use for filtering. Returns tuple of [sql-query column-alias-map].
Builds select statement from table. Optionally, brings in levels of many relationships in the from statement to use for filtering. Returns tuple of [sql-query column-alias-map].
(with-limit query limit)
(with-limit query limit offset)
Adds a limit and optionally an offset to query string.
Adds a limit and optionally an offset to query string.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close