Database Operations
all
Returns all records of the passed type, or matching a query
get
Returns a single matching record, or nil if the record doesn’t exist
get!
Returns a single record by primary key, or raises an exception if there is no matching record
get_by
Returns a single record matching the values passed, or nil if the record doesn’t exist
get_by!
Returns a single record matching the values passed, or raises an exception if there is no matching record
insert
Inserts the new data model into the database, returns a changeset
update
Updates an existing data model in the database, returns a changeset
update_all
Updates all records of type, or matching a query if one is passed as an argument
delete
Deletes a single record from the database, returns a changeset
delete_all
Deletes all records of type, or matching a query if one is passed as an argument
aggregate
Returns the result of the passed aggregation function: :avg
, :count
, :max
, :min
, or :sum
get_association
- get_association
- get_association!
- query