class Jennifer::Relation::Base(T, Q)

Overview

Base generic relation class.

T - related model Q - parent model

Direct Known Subclasses

Defined in:

jennifer/relation/base.cr

Constructors

Instance Method Summary

Instance methods inherited from class Jennifer::Relation::IRelation

join_condition(a, b) join_condition, join_query join_query, model_class model_class, preload_relation(collection, out_collection : Array(Model::Resource), pk_repo) preload_relation, query(primary_value) query, table_name table_name

Constructor Detail

def self.new(name, foreign : String | Symbol?, primary : String | Symbol?, query : QueryBuilder::Query, through = nil) #

[View source]

Instance Method Detail

def adapter #

[View source]
def condition_clause(ids : Array(DBAny)) #

[View source]
def condition_clause(id : DBAny) #

[View source]
def condition_clause #

[View source]
def foreign : String? #

[View source]
def foreign_field #

Foreign key on T model side


[View source]
def insert(obj : Q, rel : Hash(String, T::AttrType)) #

[View source]
def insert(obj : Q, rel : Hash(Symbol, T::AttrType)) #

[View source]
def insert(obj : Q, rel : T) #

[View source]
def join_condition(query, type) #

[View source]

[View source]
def model_class #

[View source]
def name : String #

[View source]
def preload_relation(collection, out_collection : Array(Model::Resource), pk_repo) #
Description copied from class Jennifer::Relation::IRelation

Preloads relation into collection from out_collection depending on keys from pk_repo.


[View source]
def primary : String? #

[View source]
def primary_field #

[View source]
def query(primary_value_or_array) #
Description copied from class Jennifer::Relation::IRelation

Returns query for given primary field values


[View source]
def remove(obj : Q, rel : T) #

[View source]
def table_name #

[View source]
def through : Symbol? #

[View source]