module Crorm::Model

Defined in:

crorm/model.cr

Macro Summary

Instance Method Summary

Macro Detail

macro field(decl, key = nil, converter = nil, pkey = false, auto = false, json_ignore = false) #

Defines a field decl with the given options.


[View source]
macro schema(table, dialect = :sqlite, strict = true, multi = false, json = true) #

[View source]
macro timestamps #

include created_at and updated_at that will automatically be updated


[View source]

Instance Method Detail

def db_changes(skip_fields : Enumerable(String)) #

[View source]
def db_changes #

[View source]
def db_values #

[View source]
def insert!(query : String = @@schema.insert_stmt, args_ = self.db_values, db : DB_ = self.class.db) #

[View source]
def pk_values #

[View source]
def update!(query : String = @@schema.update_stmt, args_ = self.update_values, db : DB_ = self.class.db) #

[View source]
def update_values #

[View source]
def upsert!(query : String = @@schema.upsert_stmt, args_ = self.db_values, db : DB_ = self.class.db) #

[View source]