class PgORM::Relation(T)

Included Modules

Defined in:

pg-orm/relation.cr

Constructors

Instance Method Summary

Instance methods inherited from module PgORM::Pagination(T)

paginate(page : Int32 = 1, limit : Int32 = 25) : PaginatedResult(T) paginate, paginate_by_offset(offset : Int32 = 0, limit : Int32 = 25) : PaginatedResult(T) paginate_by_offset, paginate_cursor(after : String | Nil = nil, before : String | Nil = nil, limit : Int32 = 25, cursor_column : Symbol = :id) : CursorPaginatedResult(T) paginate_cursor

Instance methods inherited from module PgORM::Query::Cache(T)

cached? cached?, each(& : T -> ) : Nil
each
each
, reload reload, to_a : Array(T) to_a

Instance methods inherited from module PgORM::Query::Methods(T)

all : self all, average(column_name : Symbol | String) : Float64 average, count(column_name : Symbol | String = "*", distinct = builder.distinct?) : Int64 count, delete_all : Nil delete_all, distinct(value = true) : self distinct, dup(builder : Builder) dup, exists?(id : T::PrimaryKeyType) : Bool
exists? : Bool
exists?
, find(id : T::PrimaryKeyType) : T find, find?(id : T::PrimaryKeyType) : T | Nil find?, find_by(**args) : T find_by, find_by?(**args) : T | Nil find_by?, first : T first, first? : T | Nil first?, group_by(*columns : Symbol | String) : self group_by, ids : Array(T::PrimaryKeyType) ids, join(type : JoinType, model : Base.class, fk : Symbol, pk : Base.class | Nil = nil) : self
join(type : JoinType, model : Base.class, on : String) : self
join
, last : T last, last? : T | Nil last?, limit(value : Int32) : self limit, maximum(column_name : Symbol | String) maximum, minimum(column_name : Symbol | String) minimum, none : self none, offset(value : Int32) : self offset, or(other : self) : self or, order(columns : Hash(Symbol, Symbol)) : self
order(*columns : Symbol | String) : self
order(**columns) : self
order
, pluck(column_name : Symbol | String) : Array(Value) pluck, reorder(columns : Hash(Symbol, Symbol)) : self
reorder(*columns : Symbol | String) : self
reorder(**columns) : self
reorder
, search(search_query : FullTextSearch::SearchQuery) : self search, search_ranked(search_query : FullTextSearch::SearchQuery) : self search_ranked, select(sql : String) : self
select(*columns : Symbol) : self
select
, size : Int64 size, sum(column_name : Symbol | String) : Int64 | Float64 sum, take : T take, take? : T | Nil take?, to_sql : String to_sql, unscope(*args) : self unscope, update_all(attributes : Hash | NamedTuple) : Nil
update_all(**attributes) : Nil
update_all
, where(conditions : Hash(Symbol, Value | Array(Value)) | NamedTuple) : self
where(sql : String, *splat : Value) : self
where(**conditions) : self
where
, where_between(column : Symbol | String, min : Value, max : Value) : self where_between, where_gt(column : Symbol | String, value : Value) : self where_gt, where_gte(column : Symbol | String, value : Value) : self where_gte, where_ilike(column : Symbol | String, pattern : String) : self where_ilike, where_like(column : Symbol | String, pattern : String) : self where_like, where_lt(column : Symbol | String, value : Value) : self where_lt, where_lte(column : Symbol | String, value : Value) : self where_lte, where_not(conditions : Hash(Symbol, Value | Array(Value)) | NamedTuple) : self
where_not(**conditions) : self
where_not
, where_not_between(column : Symbol | String, min : Value, max : Value) : self where_not_between, where_not_ilike(column : Symbol | String, pattern : String) : self where_not_ilike, where_not_like(column : Symbol | String, pattern : String) : self where_not_like

Constructor Detail

def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) #

[View source]
def self.new(pull : JSON::PullParser) #

[View source]

Instance Method Detail

def build(**attributes) : T #

[View source]
def create(**attributes) : T #

[View source]
def delete(*records : T) : Nil #

[View source]
def from_json(*args, **options) #

[View source]
def from_json(*args, **options, &) #

[View source]
def from_yaml(*args, **options) #

[View source]
def from_yaml(*args, **options, &) #

[View source]
def search(query : String, columns : Array(String), config : String = "english") : self #

Convenience method for full-text search


[View source]
def search(query : String, *columns : Symbol, config : String = "english") : self #

[View source]
def search(query : String, *columns : String, config : String = "english") : self #

[View source]
def search_phrase(phrase : String, columns : Array(String), config : String = "english") : self #

Convenience method for phrase search


[View source]
def search_phrase(phrase : String, *columns : Symbol, config : String = "english") : self #

[View source]
def search_phrase(phrase : String, *columns : String, config : String = "english") : self #

[View source]
def search_plain(text : String, columns : Array(String), config : String = "english") : self #

Convenience method for plain text search


[View source]
def search_plain(text : String, *columns : Symbol, config : String = "english") : self #

[View source]
def search_plain(text : String, *columns : String, config : String = "english") : self #

[View source]
def search_prefix(prefix : String, columns : Array(String), config : String = "english") : self #

Convenience method for prefix search


[View source]
def search_prefix(prefix : String, *columns : Symbol, config : String = "english") : self #

[View source]
def search_prefix(prefix : String, *columns : String, config : String = "english") : self #

[View source]
def search_proximity(word1 : String, word2 : String, distance : Int32, columns : Array(String), config : String = "english") : self #

Convenience method for proximity search


[View source]
def search_proximity(word1 : String, word2 : String, distance : Int32, *columns : Symbol, config : String = "english") : self #

[View source]
def search_proximity(word1 : String, word2 : String, distance : Int32, *columns : String, config : String = "english") : self #

[View source]
def search_ranked(query : String, columns : Array(String), config : String = "english", rank_normalization : Int32 | Nil = nil, rank_function : FullTextSearch::RankFunction = FullTextSearch::RankFunction::Rank) : self #

Convenience method for ranked full-text search


[View source]
def search_ranked(query : String, *columns : Symbol, config : String = "english", rank_normalization : Int32 | Nil = nil, rank_function : FullTextSearch::RankFunction = FullTextSearch::RankFunction::Rank) : self #

[View source]
def search_ranked(query : String, *columns : String, config : String = "english", rank_normalization : Int32 | Nil = nil, rank_function : FullTextSearch::RankFunction = FullTextSearch::RankFunction::Rank) : self #

[View source]
def search_ranked_weighted(query : String, weighted_columns : Hash(String, FullTextSearch::Weight), config : String = "english", rank_normalization : Int32 | Nil = nil, rank_function : FullTextSearch::RankFunction = FullTextSearch::RankFunction::Rank) : self #

Convenience method for ranked weighted search


[View source]
def search_ranked_weighted(query : String, weighted_columns : Hash(Symbol, FullTextSearch::Weight), config : String = "english", rank_normalization : Int32 | Nil = nil, rank_function : FullTextSearch::RankFunction = FullTextSearch::RankFunction::Rank) : self #

[View source]
def search_vector(query : String, vector_column : String, config : String = "english") : self #

Convenience method for searching pre-computed tsvector column


[View source]
def search_vector(query : String, vector_column : Symbol, config : String = "english") : self #

[View source]
def search_vector_plain(text : String, vector_column : String, config : String = "english") : self #

Convenience method for searching pre-computed tsvector column with plain text


[View source]
def search_vector_plain(text : String, vector_column : Symbol, config : String = "english") : self #

[View source]
def search_vector_ranked(query : String, vector_column : String, config : String = "english", rank_normalization : Int32 | Nil = nil, rank_function : FullTextSearch::RankFunction = FullTextSearch::RankFunction::Rank) : self #

Convenience method for searching pre-computed tsvector column with ranking


[View source]
def search_vector_ranked(query : String, vector_column : Symbol, config : String = "english", rank_normalization : Int32 | Nil = nil, rank_function : FullTextSearch::RankFunction = FullTextSearch::RankFunction::Rank) : self #

[View source]
def search_weighted(query : String, weighted_columns : Hash(String, FullTextSearch::Weight), config : String = "english") : self #

Convenience method for weighted full-text search


[View source]
def search_weighted(query : String, weighted_columns : Hash(Symbol, FullTextSearch::Weight), config : String = "english") : self #

[View source]
def to_json(*args, **options) #

[View source]
def to_json(*args, **options, &) #

[View source]
def to_pretty_json(*args, **options) #

[View source]
def to_pretty_json(*args, **options, &) #

[View source]
def to_yaml(*args, **options) #

[View source]
def to_yaml(*args, **options, &) #

[View source]