class Marten::DB::Query::ManyToManySet(M)
- Marten::DB::Query::ManyToManySet(M)
- Marten::DB::Query::Set(M)
- Reference
- Object
Overview
Represents a query set resulting from a many-to-many relation.
Defined in:
marten/db/query/many_to_many_set.crConstructors
Instance Method Summary
-
#add(objs : Enumerable(M) | Iterable(M))
Adds the given objects to the many-to-many relationship.
-
#add(*objs : M)
Adds the given objects to the many-to-many relationship.
-
#clear : Nil
Clears the many-to-many relationship.
-
#remove(objs : Enumerable(M) | Iterable(M)) : Nil
Removes the given objects from the many-to-many relationship.
-
#remove(*objs : M) : Nil
Removes the given objects from the many-to-many relationship.
Instance methods inherited from class Marten::DB::Query::Set(M)
[](index : Int)[](range : Range) [], []?(index : Int)
[]?(range : Range) []?, all all, any? any?, count(field : String | Symbol | Nil = nil) count, create(**kwargs)
create(**kwargs, &) create, create!(**kwargs)
create!(**kwargs, &) create!, delete(raw : Bool = false) : Int64 delete, distinct
distinct(*fields : String | Symbol) distinct, each(&) each, exclude(query_node : Node)
exclude(**kwargs)
exclude(&) exclude, exists?(query_node : Node)
exists?
exists?(**kwargs)
exists?(&) exists?, filter(query_node : Node)
filter(**kwargs)
filter(&) filter, first first, first! first!, get(query_node : Node)
get(**kwargs)
get(&) get, get!(query_node : Node)
get!(**kwargs)
get!(&) get!, get_or_create(**kwargs)
get_or_create(**kwargs, &) get_or_create, get_or_create!(**kwargs)
get_or_create!(**kwargs, &) get_or_create!, includes?(value : M) includes?, inspect(io) inspect, join(*relations : String | Symbol) join, last last, last! last!, model model, none none, order(fields : Array(String | Symbol))
order(*fields : String | Symbol) order, paginator(page_size : Int) paginator, pick(fields : Array(String | Symbol)) : Array(Field::Any) | Nil
pick(*fields : String | Symbol) : Array(Field::Any) | Nil pick, pick!(fields : Array(String | Symbol)) : Array(Field::Any)
pick!(*fields : String | Symbol) : Array(Field::Any) pick!, pluck(fields : Array(String | Symbol)) : Array(Array(Field::Any))
pluck(*fields : String | Symbol) : Array(Array(Field::Any)) pluck, raw(query : String, params : Array)
raw(query : String, params : Hash | NamedTuple)
raw(query : String, *args)
raw(query : String, **kwargs) raw, resolve_template_attribute(key : String) resolve_template_attribute, reverse reverse, size size, to_s(io) to_s, update(values : Hash | NamedTuple)
update(**kwargs) update, using(db : Nil | String | Symbol) using
Constructor methods inherited from class Marten::DB::Query::Set(M)
new(query : Marten::DB::Query::SQL::Query(M) = SQL::Query(M).new)
new
Constructor Detail
Instance Method Detail
def add(objs : Enumerable(M) | Iterable(M))
#
Adds the given objects to the many-to-many relationship.
If the objects specified in objs
are already in the relationship, they will be skipped and not added again.
def add(*objs : M)
#
Adds the given objects to the many-to-many relationship.
If the objects specified in objs
are already in the relationship, they will be skipped and not added again.
def remove(objs : Enumerable(M) | Iterable(M)) : Nil
#
Removes the given objects from the many-to-many relationship.