(generate-update db table map)
Generate a hugsql map for an update statement by primary key. Return nil if the primary key is not present or if all keys that forms a primary key are not present in the map.
Generate a hugsql map for an update statement by primary key. Return nil if the primary key is not present or if all keys that forms a primary key are not present in the map.
(get-columns db table)
Return a list of column names from the given table. If you call it too much it might be slow, if you memoize it your code can become out of sync with the db. Use it wisely.
Return a list of column names from the given table. If you call it too much it might be slow, if you memoize it your code can become out of sync with the db. Use it wisely.
(include-keys? aset amap)
State if all the keys in a set are present in the keyset of a map
State if all the keys in a set are present in the keyset of a map
(maps->table-rows db table coll)
Coerce a coll of map to a coll of rows. A map is an open set of key/values
where keys can be namespaced keywords. A row is a closed set of key/values
where keys are unnamespaced strings matching column names of the given table
in db
. Given a Users
table of (id, age) in database, a given table
of
value :users and a coll of [{:user/id 1, :user/age 42, :project/id 2}], will
produce ({'id' 1, 'age' 42}).
Coerce a coll of map to a coll of rows. A map is an open set of key/values where keys can be namespaced keywords. A row is a closed set of key/values where keys are unnamespaced strings matching column names of the given `table` in `db`. Given a `Users` table of (id, age) in database, a given `table` of value :users and a coll of [{:user/id 1, :user/age 42, :project/id 2}], will produce ({'id' 1, 'age' 42}).
(pure-db db-or-t)
Return a db-spec on which we can extract metadata, be it a simple db map or a transaction map.
Return a db-spec on which we can extract metadata, be it a simple db map or a transaction map.
(restrict-map-to-columns columns amap)
Keep only keys in the map that appears in the table in database
Keep only keys in the map that appears in the table in database
(stringify-keys amap)
Transform keys of a map to string, drop namespaces. Since namespace is droped, later occurence of a key name will take precedence. Eg: {:foo/a 1, :bar/a 2} -> {"a" 2}
Transform keys of a map to string, drop namespaces. Since namespace is droped, later occurence of a key name will take precedence. Eg: {:foo/a 1, :bar/a 2} -> {"a" 2}
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close