abstract class CROM::Repository(T)

Included Modules

Defined in:

crom/repository.cr

Constructors

Class Method Summary

Instance Method Summary

Macro Summary

Constructor Detail

def self.new(container : CROM::Container) #

[View source]

Class Method Detail

def self.[](*args, **options) #

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

[View source]
def self.all(*args, **options) #

[View source]
def self.all(*args, **options, &) #

[View source]
def self.delete(*args, **options) #

[View source]
def self.delete(*args, **options, &) #

[View source]
def self.insert(*args, **options) #

[View source]
def self.insert(*args, **options, &) #

[View source]
def self.name #

return {{@type.name.stringify}}


[View source]
def self.repo #

[View source]
def self.update(*args, **options) #

[View source]
def self.update(*args, **options, &) #

[View source]

Instance Method Detail

abstract def [](id) #

Method used to get a model by id

model = repository[12]
if mymodel = model
  # do stuff with mymodel
end

[View source]
abstract def all #

Get all the models in the repository


[View source]
def container #

[View source]
def delete(model : T) #

execute the do_delete method and call model.after_delete if defined


[View source]
def do_after_delete(model : T, *args) #

check if the method after_delete exists and call it


[View source]
def do_after_insert(model : T, *args) #

check if the method after_insert exists and call it


[View source]
def do_after_update(model : T, *args) #

check if the method after_update exists and call it


[View source]
abstract def do_delete(model : T, *args) #

execute delete


[View source]
abstract def do_insert(model : T, *args) #

execute insert operation


[View source]
abstract def do_update(model : T, *args) #

execute update


[View source]
def insert(model : T) #

execute the do_insert method and call model.after_insert if defined


[View source]
def update(model : T) #

execute the do_update method and call model.after_update if defined


[View source]

Macro Detail

macro commands(*methods) #

[View source]
macro def_repo_method(name) #

macro used to define insert, update, delete methods


[View source]