module Onyx::SQL::Model::ClassQueryShortcuts(T)

Overview

This module is extended by an object whenever it includes the Model module. It brings shortucts to a matching query initialization:

class User
  include Onyx::SQL::Model
end

User.query == Query(User).new

Defined in:

onyx-sql/model/class_query_shortcuts.cr

Instance Method Summary

Instance Method Detail

def all(*args, **nargs) : Onyx::SQL::Query(T) #

Create a new Query(self) and call Query#all on it.


[View source]
def delete(*args, **nargs) : Onyx::SQL::Query(T) #

Create a new Query(self) and call Query#delete on it.


[View source]
def group_by(*args, **nargs) : Onyx::SQL::Query(T) #

Create a new Query(self) and call Query#group_by on it.


[View source]
def having(*args, **nargs) : Onyx::SQL::Query(T) #

Create a new Query(self) and call Query#having on it.


[View source]
def insert(*args, **nargs) : Onyx::SQL::Query(T) #

Create a new Query(self) and call Query#insert on it.


[View source]
def join(reference : T::Reference, klass, *, on : String? = nil, as _as : String = reference.to_s.underscore, type : JoinType = :inner, &block) #

Create a new Query(self) and call Query#join on it.


[View source]
def join(reference : T::Reference, on : String? = nil, as _as : String = reference.to_s.underscore, type : Onyx::SQL::Query::JoinType = :inner) : Onyx::SQL::Query(T) #

Create a new Query(self) and call Query#join on it.


[View source]
def join(table : String, on : String, as _as : String? = nil, type : Onyx::SQL::Query::JoinType = :inner) : Onyx::SQL::Query(T) #

Create a new Query(self) and call Query#join on it.


[View source]
def limit(*args, **nargs) : Onyx::SQL::Query(T) #

Create a new Query(self) and call Query#limit on it.


[View source]
def offset(*args, **nargs) : Onyx::SQL::Query(T) #

Create a new Query(self) and call Query#offset on it.


[View source]
def one(*args, **nargs) : Onyx::SQL::Query(T) #

Create a new Query(self) and call Query#one on it.


[View source]
def order_by(value : T::Field | String, order : Query::Order? = nil) : Onyx::SQL::Query(T) #

Create a new Query(self) and call Query#order_by on it.


[View source]
def query : Query #

Create a new Query(T).


[View source]
def returning(values : Enumerable(T::Field | T::Reference | Char | String)) #

Create a new Query(self) and call Query#returning on it.


[View source]
def returning(klass : T.class, *values : T::Field | T::Reference | Char | String) #

Create a new Query(self) and call Query#returning on it.


[View source]
def returning(*values : T::Field | T::Reference | Char | String) #

Create a new Query(self) and call Query#returning on it.


[View source]
def select(values : Enumerable(T::Field | T::Reference | Char | String)) #

Create a new Query(self) and call Query#select on it.


[View source]
def select(klass : T.class, *values : T::Field | T::Reference | Char | String) #

Create a new Query(self) and call Query#select on it.


[View source]
def select(*values : T::Field | T::Reference | Char | String) #

Create a new Query(self) and call Query#select on it.


[View source]
def set(*args, **nargs) : Onyx::SQL::Query(T) #

Create a new Query(self) and call Query#set on it.


[View source]
def update(*args, **nargs) : Onyx::SQL::Query(T) #

Create a new Query(self) and call Query#update on it.


[View source]
def where(*args, **nargs) : Onyx::SQL::Query(T) #

Create a new Query(self) and call Query#where on it.


[View source]