View Source FatEcto.FatQuery.FatWhere (FatEcto v1.0.0)
Where supports multiple query methods.
=> like
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map.
Example
iex> query_opts = %{ ...> "$select" => %{"$fields" => ["phone", "designation", "experience_years"]}, ...> "$where" => %{"designation" => %{"$like" => "%Joh %"}} ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatDoctor, query_opts) #Ecto.Query<from f0 in FatEcto.FatDoctor, where: like(fragment("(?)::TEXT", f0.designation), ^"%Joh %") and ^true, select: map(f0, [:phone, :designation, :experience_years])>
Options
$select
- Select the fields fromdoctor
.$like
- Added the like attribute in the where query.
=> iLike
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{"$fields" => ["phone", "designation", "experience_years"]}, ...> "$where" => %{"designation" => %{"$ilike" => "%surge %"}}, ...> "$order" => %{"rating" => "$asc"} ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatDoctor, query_opts) #Ecto.Query<from f0 in FatEcto.FatDoctor, where: ilike(fragment("(?)::TEXT", f0.designation), ^"%surge %") and ^true, order_by: [asc: f0.rating], select: map(f0, [:phone, :designation, :experience_years])>
Options
$select
- Select the fields fromdoctor
.$ilike
- Added the ilike attribute in the where query.$order
- Sort the result based on the order attribute.
=> notLike
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{ ...> "$fields" => ["name", "location", "rating"], ...> "fat_rooms" => ["name", "floor"], ...> }, ...> "$where" => %{"location" => %{"$not_like" => "%street2 %"}}, ...> "$order" => %{"id" => "$desc"} ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts) #Ecto.Query<from f0 in FatEcto.FatHospital, where: not like(fragment("(?)::TEXT", f0.location), ^"%street2 %") and ^true, order_by: [desc: f0.id], select: map(f0, [:name, :location, :rating, fat_rooms: [:name, :floor]])>
Options
$select
- Select the fields fromhospital
androoms
.$not_like
- Added the notlike attribute in the where query.$order
- Sort the result based on the order attribute.
=> notILike
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{ ...> "$fields" => ["name", "location", "rating"] ...> }, ...> "$where" => %{"location" => %{"$not_ilike" => "%street2 %"}}, ...> "$group" => "rating" ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts) #Ecto.Query<from f0 in FatEcto.FatHospital, where: not ilike(fragment("(?)::TEXT", f0.location), ^"%street2 %") and ^true, group_by: [f0.rating], select: map(f0, [:name, :location, :rating])>
Options
$select
- Select the fields fromhospital
androoms
.$not_ilike
- Added the notilike attribute in the where query.$group
- Added the group_by attribute in the query.
=> lessThan
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{ ...> "$fields" => ["name", "location", "rating"] ...> }, ...> "$where" => %{"rating" => %{"$lt" => 4}} ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts) #Ecto.Query<from f0 in FatEcto.FatHospital, where: f0.rating < ^4 and ^true, select: map(f0, [:name, :location, :rating])>
Options
$select
- Select the fields fromhospital
.$lt
- Added the lessthan attribute in the where query.
=> lessThan the other field
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{ ...> "$fields" => ["name", "location", "rating"] ...> }, ...> "$where" => %{"total_staff" => %{"$lt" => "$rating"}}, ...> "$order" => %{"id" => "$desc"} ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts) #Ecto.Query<from f0 in FatEcto.FatHospital, where: f0.total_staff < f0.rating and ^true, order_by: [desc: f0.id], select: map(f0, [:name, :location, :rating])>
Options
$select
- Select the fields fromhospital
.$lt: :$field
- Added the lessthan attribute in the where query.$order
- Sort the result based on the order attribute.
=> lessThanEqual
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{ ...> "$fields" => ["name", "location", "rating"], ...> "fat_rooms" => ["name", "floor"] ...> }, ...> "$where" => %{"total_staff" => %{"$lte" => 3}}, ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts) #Ecto.Query<from f0 in FatEcto.FatHospital, where: f0.total_staff <= ^3 and ^true, select: map(f0, [:name, :location, :rating, fat_rooms: [:name, :floor]])>
Options
$select
- Select the fields fromhospital
androoms
.$lte
- Added the lessthanequal attribute in the where query.
=> lessThanEqual the other field
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{ ...> "$fields" => ["name", "location", "rating"], ...> "fat_rooms" => ["name", "floor"] ...> }, ...> "$where" => %{"total_staff" => %{"$lte" => "$rating"}}, ...> "$group" => "total_staff" ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts) #Ecto.Query<from f0 in FatEcto.FatHospital, where: f0.total_staff <= f0.rating and ^true, group_by: [f0.total_staff], select: map(f0, [:name, :location, :rating, fat_rooms: [:name, :floor]])>
Options
$select
- Select the fields fromhospital
androoms
.$lte: :$field
- Added the lessthanequal attribute in the where query.$group
- Added the group_by attribute in the query.
=> greaterThan
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{ ...> "$fields" => ["name", "location", "rating"], ...> "fat_rooms" => ["name", "floor"] ...> }, ...> "$where" => %{"total_staff" => %{"$gt" => 4}}, ...> "$group" => "total_staff", ...> "$order" => %{"rating" => "$desc"} ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts) #Ecto.Query<from f0 in FatEcto.FatHospital, where: f0.total_staff > ^4 and ^true, group_by: [f0.total_staff], order_by: [desc: f0.rating], select: map(f0, [:name, :location, :rating, fat_rooms: [:name, :floor]])>
Options
$select
- Select the fields fromhospital
androoms
.$gt
- Added the lessthan attribute in the where query.$group
- Added the group_by attribute in the query.$order
- Sort the result based on the order attribute.
=> greaterThan the other field
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{ ...> "$fields" => ["name", "location", "rating"], ...> "fat_rooms" => ["name", "floor"] ...> }, ...> "$where" => %{"total_staff" => %{"$gt" => "$rating"}}, ...> "$include" => %{ ...> "fat_doctors" => %{ ...> "$where" => %{"rating" => %{"$lt" => 3}}, ...> "$order" => %{"id" => "$desc"} ...> } ...> } ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts) #Ecto.Query<from f0 in FatEcto.FatHospital, left_join: f1 in assoc(f0, :fat_doctors), where: f0.total_staff > f0.rating and ^true, where: f1.rating < ^3 and ^true, order_by: [desc: f1.id], limit: ^34, offset: ^0, select: map(f0, [:name, :location, :rating, fat_rooms: [:name, :floor]]), preload: [:fat_doctors]>
Options
$select
- Select the fields fromhospital
.$gt: :$field
- Added the greaterthan attribute in the where query.$include
- Include the assoication modeldoctors
.$lt
- Added the lessthan attribute in the where query inside include.
=> greaterThanEqual
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{ ...> "$fields" => ["name", "location", "rating"], ...> "fat_rooms" => ["name", "floor"] ...> }, ...> "$where" => %{"total_staff" => %{"$gte" => 5}}, ...> "$include" => %{ ...> "fat_doctors" => %{ ...> "$where" => %{"rating" => %{"$lte" => 3}}, ...> } ...> } ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts) #Ecto.Query<from f0 in FatEcto.FatHospital, left_join: f1 in assoc(f0, :fat_doctors), where: f0.total_staff >= ^5 and ^true, where: f0.rating <= ^3 and ^true, limit: ^34, offset: ^0, select: map(f0, [:name, :location, :rating, fat_rooms: [:name, :floor]]), preload: [:fat_doctors]>
Options
$select
- Select the fields fromhospital
androoms
.$gte
- Added the greaterthanequal attribute in the where query.$include
- Include the assoication modeldoctors
.$lte
- Added the lessthanequal attribute in the where query inside include.
=> greaterThanEqual the other field
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{ ...> "$fields" => ["name", "location", "rating"], ...> "fat_rooms" => ["name", "floor"] ...> }, ...> "$where" => %{"rating" => %{"$gte" => "$total_staff"}}, ...> "$include" => %{ ...> "fat_doctors" => %{ ...> "$where" => %{"rating" => %{"$gte" => 3}}, ...> "$order" => %{"rating" => "$asc"} ...> } ...> } ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts) #Ecto.Query<from f0 in FatEcto.FatHospital, left_join: f1 in assoc(f0, :fat_doctors), where: f0.rating >= f0.total_staff and ^true, where: f1.rating >= ^3 and ^true, order_by: [asc: f1.rating], limit: ^34, offset: ^0, select: map(f0, [:name, :location, :rating, fat_rooms: [:name, :floor]]), preload: [:fat_doctors]>
Options
$select
- Select the fields fromhospital
androoms
.$gte: :$field
- Added the greaterthanequal attribute in the where query.$include
- Include the assoication modeldoctors
.$gte
- Added the greaterthanequal attribute in the where query inside include.$order
- Sort the result based on the order attribute.
=> between
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{ ...> "$fields" => ["name", "location", "rating"], ...> "fat_rooms" => ["name", "floor"] ...> }, ...> "$where" => %{"rating" => %{"$between" => [10, 20]}}, ...> "$include" => %{ ...> "fat_doctors" => %{ ...> "$include" => ["fat_patients"], ...> "$where" => %{"rating" => %{"$gte" => "$total_staff"}}, ...> "$order" => %{"rating" => "$asc"} ...> } ...> } ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts) #Ecto.Query<from f0 in FatEcto.FatHospital, left_join: f1 in assoc(f0, :fat_doctors), where: f0.rating > ^10 and f0.rating < ^20 and ^true, where: f1.rating >= f1.total_staff and ^true, order_by: [asc: f1.rating], limit: ^34, offset: ^0, select: map(f0, [:name, :location, :rating, {:fat_rooms, [:name, :floor]}]), preload: [[fat_doctors: [:fat_patients]]]>
Options
$select
- Select the fields fromhospital
androoms
.$between: :$field
- Added the between attribute in the where query.$include
- Include the assoication modeldoctors
andpatients
.$gte
- Added the greaterthanequal attribute in the where query inside include.$order
- Sort the result based on the order attribute.
=> not_between
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{ ...> "$fields" => ["name", "location", "rating"], ...> "fat_rooms" => ["name", "floor"] ...> }, ...> "$where" => %{"rating" => %{"$not_between" => [10, 20]}}, ...> "$include" => %{ ...> "fat_doctors" => %{ ...> "$include" => ["fat_patients"], ...> "$where" => %{"rating" => %{"$between" => [20, 30]}}, ...> "$order" => %{"experience_years" => "$asc"} ...> } ...> } ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts) #Ecto.Query<from f0 in FatEcto.FatHospital, left_join: f1 in assoc(f0, :fat_doctors), where: (f0.rating < ^10 or f0.rating > ^20) and ^true, where: f1.rating > ^20 and f1.rating < ^30 and ^true, order_by: [asc: f1.experience_years], limit: ^34, offset: ^0, select: map(f0, [:name, :location, :rating, {:fat_rooms, [:name, :floor]}]), preload: [[fat_doctors: [:fat_patients]]]>
Options
$select
- Select the fields fromhospital
androoms
.$not_between: :$field
- Added the notbetween attribute in the where query.$include
- Include the assoication modeldoctors
andpatients
.$between
- Added the between attribute in the where query inside include.$order
- Sort the result based on the order attribute.
=> in
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{ ...> "$fields" => ["name", "location", "rating"], ...> "fat_rooms" => ["name", "floor"] ...> }, ...> "$where" => %{"rating" => %{"$in" => [10, 20]}}, ...> "$include" => %{ ...> "fat_doctors" => %{ ...> "$include" => ["fat_patients"], ...> "$where" => %{"rating" => %{"$not_between" => [20, 30]}}, ...> "$order" => %{"experience_years" => "$asc"} ...> } ...> }, ...> "$right_join" => %{ ...> "fat_rooms" => %{ ...> "$on_field" => "id", ...> "$on_table_field" => "hospital_id", ...> "$select" => ["name", "purpose", "floor"], ...> "$where" => %{"floor" => %{"$gte" => 2}} ...> } ...> } ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts) #Ecto.Query<from f0 in FatEcto.FatHospital, right_join: f1 in "fat_rooms", on: f0.id == f1.hospital_id, left_join: f2 in assoc(f0, :fat_doctors), where: f0.rating in ^[10, 20] and ^true, where: f1.floor >= ^2 and ^true, where: (f2.rating < ^20 or f2.rating > ^30) and ^true, order_by: [asc: f2.experience_years], limit: ^34, offset: ^0, select: merge(map(f0, [:name, :location, :rating, fat_rooms: [:name, :floor]]), %{ ^"fat_rooms" => map(f1, [:name, :purpose, :floor]) }), preload: [fat_doctors: [:fat_patients]]>
Options
$select
- Select the fields fromhospital
androoms
.$right_join: :$select
- Select the fields fromrooms
.$right_join
- Right join the tablerooms
.$gte: :$field
- Added the greaterthanequal attribute in the where query inside join.$include
- Include the assoication modeldoctors
andpatients
.$not_between
- Added the notbetween in the where query inside include .$in
- Added the in attribute in the where query.$order
- Sort the result based on the order attribute.
=> not_in
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{ ...> "$fields" => ["name", "location", "rating"], ...> "fat_rooms" => ["name", "floor"] ...> }, ...> "$where" => %{"rating" => %{"$not_in" => [10, 20]}}, ...> "$include" => %{ ...> "fat_doctors" => %{ ...> "$include" => ["fat_patients"], ...> "$where" => %{"rating" => %{"$not_between" => [20, 30]}}, ...> "$order" => %{"rating" => "$desc"} ...> } ...> }, ...> "$right_join" => %{ ...> "fat_rooms" => %{ ...> "$on_field" => "id", ...> "$on_table_field" => "hospital_id", ...> "$select" => ["name", "floor", "is_active"], ...> "$where" => %{"floor" => %{"$not_in" => [5, 15]}} ...> } ...> } ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts) #Ecto.Query<from f0 in FatEcto.FatHospital, right_join: f1 in "fat_rooms", on: f0.id == f1.hospital_id, left_join: f2 in assoc(f0, :fat_doctors), where: f0.rating not in ^[10, 20] and ^true, where: f1.floor not in ^[5, 15] and ^true, where: (f2.rating < ^20 or f2.rating > ^30) and ^true, order_by: [desc: f2.rating], limit: ^34, offset: ^0, select: merge(map(f0, [:name, :location, :rating, {:fat_rooms, [:name, :floor]}]), %{^"fat_rooms" => map(f1, [:name, :floor, :is_active])}), preload: [[fat_doctors: [:fat_patients]]]>
Options
$select
- Select the fields fromhospital
androoms
.$right_join: :$select
- Select the fields fromrooms
.$right_join
- Right join the tablerooms
.$not_in
- Added the notin attribute in the where query inside join.$include
- Include the assoication modeldoctors
andpatients
.$not_between
- Added the notbetween in the where query inside include .$not_in
- Added the in attribute in the where query.$order
- Sort the result based on the order attribute.
=> is_nil
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{ ...> "$fields" => ["name", "location", "rating"], ...> "fat_rooms" => ["floor", "name"] ...> }, ...> "$where" => %{"rating" => nil}, ...> "$include" => %{ ...> "fat_doctors" => %{ ...> "$include" => ["fat_patients"], ...> "$where" => %{"rating" => %{"$between" => [20, 30]}}, ...> "$order" => %{"experience_years" => "$desc"} ...> } ...> }, ...> "$right_join" => %{ ...> "fat_rooms" => %{ ...> "$on_field" => "id", ...> "$on_table_field" => "hospital_id", ...> "$select" => ["name", "floor", "is_active"], ...> "$where" => %{"floor" => %{"$in" => [5, 15]}}, ...> "$order" => %{"id" => "$asc"} ...> } ...> } ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts) #Ecto.Query<from f0 in FatEcto.FatHospital, right_join: f1 in "fat_rooms", on: f0.id == f1.hospital_id, left_join: f2 in assoc(f0, :fat_doctors), where: is_nil(f0.rating) and ^true, where: f1.floor in ^[5, 15] and ^true, where: f2.rating > ^20 and f2.rating < ^30 and ^true, order_by: [asc: f1.id], order_by: [desc: f2.experience_years], limit: ^34, offset: ^0, select: merge(map(f0, [:name, :location, :rating, {:fat_rooms, [:floor, :name]}]), %{^"fat_rooms" => map(f1, [:name, :floor, :is_active])}), preload: [[fat_doctors: [:fat_patients]]]>
Options
$select
- Select the fields fromhospital
androoms
.$right_join: :$select
- Select the fields fromrooms
.$right_join
- Right join the tablerooms
.$in
- Added the in attribute in the where query inside join.$include
- Include the assoication modeldoctors
andpatients
.$between
- Added the between in the where query inside include .nil
- Added the nil attribute in the where query.$order
- Sort the result based on the order attribute.$right_join: :$order
- Sort the result based on the order attribute inside join.
=> not_null
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{ ...> "$fields" => ["name", "location", "rating"], ...> "fat_rooms" => ["name", "floor"] ...> }, ...> "$where" => %{"$not_null" => ["total_staff"]}, ...> "$include" => %{ ...> "fat_doctors" => %{ ...> "$include" => ["fat_patients"], ...> "$where" => %{"rating" => %{"$in" => [20, 30]}}, ...> "$order" => %{"rating" => "$asc"}, ...> "$select" => ["name", "designation", "phone"] ...> } ...> }, ...> "$right_join" => %{ ...> "fat_rooms" => %{ ...> "$on_field" => "id", ...> "$on_table_field" => "hospital_id", ...> "$select" => ["name", "floor", "is_active"], ...> "$where" => %{"name" => nil}, ...> "$order" => %{"id" => "$asc"} ...> } ...> } ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts) #Ecto.Query<from f0 in FatEcto.FatHospital, right_join: f1 in "fat_rooms", on: f0.id == f1.hospital_id, left_join: f2 in assoc(f0, :fat_doctors), where: not is_nil(f0.total_staff) and ^true, where: is_nil(f1.name) and ^true, where: f2.rating in ^[20, 30] and ^true, order_by: [asc: f1.id], order_by: [asc: f2.rating], limit: ^34, offset: ^0, select: merge(map(f0, [:name, :location, :rating, fat_rooms: [:name, :floor]]), %{ ^"fat_rooms" => map(f1, [:name, :floor, :is_active]) }), preload: [fat_doctors: [:fat_patients]]>
Options
$select
- Select the fields fromhospital
androoms
.$right_join: :$select
- Select the fields fromrooms
.$include: :$select
- Select the fields fromdoctors
.$right_join
- Right join the tablerooms
.nil
- Added the nil attribute in the where query inside join.$include
- Include the assoication modeldoctors
andpatients
.$in
- Added the in attribute in the where query inside include .$not_null
- Added the notnil attribute in the where query.$order
- Sort the result based on the order attribute.$right_join: :$order
- Sort the result based on the order attribute inside join.
=> field
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Example
iex> query_opts = %{ ...> "$select" => %{ ...> "$fields" => ["name", "location", "rating"], ...> "fat_rooms" => ["name", "floor"] ...> }, ...> "$where" => %{"name" => "saint claire"}, ...> "$group" => "rating", ...> "$include" => %{ ...> "fat_doctors" => %{ ...> "$include" => ["fat_patients"], ...> "$where" => %{"rating" => %{"$gt" => 5}}, ...> "$order" => %{"experience_years" => "$desc"}, ...> "$select" => ["name", "designation", "phone"] ...> } ...> }, ...> "$right_join" => %{ ...> "fat_rooms" => %{ ...> "$on_field" => "id", ...> "$on_table_field" => "hospital_id", ...> "$select" => ["floor", "name", "is_active"], ...> "$where" => %{"floor" => 10}, ...> "$order" => %{"id" => "$asc"} ...> } ...> } ...> } iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts) #Ecto.Query<from f0 in FatEcto.FatHospital, right_join: f1 in "fat_rooms", on: f0.id == f1.hospital_id, left_join: f2 in assoc(f0, :fat_doctors), where: f0.name == ^"saint claire" and ^true, where: f1.floor == ^10 and ^true, where: f2.rating > ^5 and ^true, group_by: [f0.rating], order_by: [asc: f1.id], order_by: [desc: f2.experience_years], limit: ^34, offset: ^0, select: merge(map(f0, [:name, :location, :rating, fat_rooms: [:name, :floor]]), %{ ^"fat_rooms" => map(f1, [:floor, :name, :is_active]) }), preload: [fat_doctors: [:fat_patients]]>
Options
$select
- Select the fields fromhospital
androoms
.$right_join: :$select
- Select the fields fromrooms
.$include: :$select
- Select the fields fromdoctors
.$right_join
- Right join the tablerooms
.$include
- Include the assoication modeldoctors
andpatients
.$gt
- Added the greaterthan attribute in the where query inside include .$order
- Sort the result based on the order attribute.$right_join: :$order
- Sort the result based on the order attribute inside join.$group
- Added the group_by attribute in the query.
Summary
Functions
Build a where query
depending on the params.
Functions
@spec build_where(Ecto.Queryable.t(), map() | keyword(), map() | keyword(), keyword()) :: Ecto.Query.t()
Build a where query
depending on the params.
Parameters
queryable
- Ecto Queryable that represents your schema name, table name or query.query_opts
- Include query options as a map
Examples
iex> query_opts = %{
...> "$select" => %{
...> "$fields" => ["name", "location", "rating"],
...> "fat_rooms" => ["name", "floor"]
...> },
...> "$order" => %{"id" => "$desc"},
...> "$where" => %{"location" => %{"$not_like" => "%addre %"}},
...> "$group" => "total_staff"
...> }
iex> Elixir.MyApp.Query.build!(FatEcto.FatHospital, query_opts)
#Ecto.Query<from f0 in FatEcto.FatHospital, where: not(like(fragment("(?)::TEXT", f0.location), ^"%addre %")) and ^true, group_by: [f0.total_staff], order_by: [desc: f0.id], select: map(f0, [:name, :location, :rating, {:fat_rooms, [:name, :floor]}])>
Options
$select
- Select the fields fromhospital
androoms
.$where
- Added the where attribute in the query.$not_like
- Added the notlike attribute in the where query.$group
- Added the group_by attribute in the query.$order
- Sort the result based on the order attribute.