gungnir.changeset
assoc
(assoc ?changeset & kvs)
Add key value pairs to ?changeset
. If ?changeset
is a model record then create a new changeset. Key value pairs will be added to :changeset/params
.
cast
(cast m ?model)
Cast the map m
to a record of ?model
. Any unknown keys will be discarded. Strings and keywords will be converted to qualified-keywords.
create
(create params)
(create ?origin ?params)
(create origin params validators)
Create a changeset to be inserted into the database. Changesets can either be used to create or update a row.
params
will update the record with the fields supplied. params
must be cast to a proper model record. If no other map is supplied, the changeset will create a new row on save!
.
origin
is a map of the original record to be updated. If an origin
map is provided, and the primary-key
is not nil, it will update the row on save!
validators
can also be supplied to perform extra checks on the entire resulting record.
merge
(merge ?changeset & m)
Merge maps into ?changeset
. If ?changeset
is a model record then create a new changeset. All maps in m
will be merged into :changeset/params
.
update
(update ?changeset & kvs)
Update ?changeset
with key value pairs. If ?changeset
is a model record then create a new changeset. Key value pairs will be update in :changeset/params
. If a key is not found in :changeset/params
, the key will be taken from :changeset/origin
, updated, and added to :changeset/params
.