plasm v0.2.0 Plasm
Summary
Functions
Builds an avg query for a given field
Builds a count query
Builds a distinct count query for a given field (atom)
Builds a distinct query for a given field (atom)
Builds a query that finds the record matching the provided primary key value
Builds a query that finds the first record after sorting by inserted_at
ascending
Builds a query that finds the first n records after sorting by inserted_at
ascending
Builds a query that finds all records inserted after a specified string that is castable to %Ecto.DateTime{}
Builds a query that finds all records inserted on or after a specified string that is castable to %Ecto.DateTime{}
Builds a query that finds all records inserted before a specified string that is castable to %Ecto.DateTime{}
Builds a query that finds all records inserted on or before a specified string that is castable to %Ecto.DateTime{}
Builds a query that finds the last record after sorting by inserted_at
ascending
Builds a query that finds the last n records after sorting by inserted_at
ascending
Builds a max query for a given field
Builds a min query for a given field
Builds a query that grabs a random record
Builds a query that grabs n random records
Builds a sum query for a given field
Builds a query that finds all records updated after a specified string that is castable to %Ecto.DateTime{}
Builds a query that finds all records updated on or after a specified string that is castable to %Ecto.DateTime{}
Builds a query that finds all records updated before a specified string that is castable to %Ecto.DateTime{}
Builds a query that finds all records updated on or before a specified string that is castable to %Ecto.DateTime{}
Builds a query that finds all records matching all specified field names and values
Builds a query that finds all records matching none of the specified field names and values
Functions
Builds a distinct count query for a given field (atom).
Puppy |> Plasm.count_distinct(:name) |> Repo.one
Builds a distinct query for a given field (atom).
Puppy |> Plasm.distinct_by(:name) |> Repo.all
Builds a query that finds the record matching the provided primary key value.
Puppy |> Plasm.find(10) |> Repo.one
Builds a query that finds the first record after sorting by inserted_at
ascending.
Puppy |> Plasm.first |> Repo.one
Builds a query that finds the first n records after sorting by inserted_at
ascending.
Puppy |> Plasm.first(20) |> Repo.all
Builds a query that finds all records inserted after a specified string that is castable to %Ecto.DateTime{}
.
Puppy |> Plasm.inserted_after("2014-04-17T14:00:00Z") |> Repo.all
Builds a query that finds all records inserted on or after a specified string that is castable to %Ecto.DateTime{}
.
Puppy |> Plasm.inserted_after_incl("2014-04-17T14:00:00Z") |> Repo.all
Builds a query that finds all records inserted before a specified string that is castable to %Ecto.DateTime{}
.
Puppy |> Plasm.inserted_before("2014-04-17T14:00:00Z") |> Repo.all
Builds a query that finds all records inserted on or before a specified string that is castable to %Ecto.DateTime{}
.
Puppy |> Plasm.inserted_before_incl("2014-04-17T14:00:00Z") |> Repo.all
Builds a query that finds the last record after sorting by inserted_at
ascending.
Puppy |> Plasm.last |> Repo.one
Builds a query that finds the last n records after sorting by inserted_at
ascending.
Puppy |> Plasm.last(20) |> Repo.all
Builds a query that finds all records updated after a specified string that is castable to %Ecto.DateTime{}
.
Puppy |> Plasm.updated_after("2014-04-17T14:00:00Z") |> Repo.all
Builds a query that finds all records updated on or after a specified string that is castable to %Ecto.DateTime{}
.
Puppy |> Plasm.updated_after_incl("2014-04-17T14:00:00Z") |> Repo.all
Builds a query that finds all records updated before a specified string that is castable to %Ecto.DateTime{}
.
Puppy |> Plasm.updated_before("2014-04-17T14:00:00Z") |> Repo.all
Builds a query that finds all records updated on or before a specified string that is castable to %Ecto.DateTime{}
.
Puppy |> Plasm.updated_before_incl("2014-04-17T14:00:00Z") |> Repo.all
Builds a query that finds all records matching all specified field names and values.
Values can be lists or non-lists.
When the values are all non-lists, it simply delegates to Ecto.Query.where
.
When there is at least one list value, it builds the query itself, using in
for lists.
Puppy |> Plasm.where_all(name: "Fluffy", age: 3) |> Repo.all
Puppy |> Plasm.where_all(name: "Fluffy", age: [3,5,10]) |> Repo.all
Builds a query that finds all records matching none of the specified field names and values.
Values can be lists or non-lists.
Non-list expressions result in a !=
comparison.
List expressions result in a not in
comparison.
Puppy |> Plasm.where_none(name: "Fluffy", age: 3) |> Repo.all
Puppy |> Plasm.where_none(name: "Fluffy", age: [3,5,10]) |> Repo.all