abstract class CROM::Repository(T)
- CROM::Repository(T)
- Reference
- Object
Included Modules
Defined in:
crom/repository.crConstructors
Class Method Summary
- .[](*args, **options)
- .[](*args, **options, &)
- .all(*args, **options)
- .all(*args, **options, &)
- .delete(*args, **options)
- .delete(*args, **options, &)
- .insert(*args, **options)
- .insert(*args, **options, &)
-
.name
return {{@type.name.stringify}}
- .repo
- .update(*args, **options)
- .update(*args, **options, &)
Instance Method Summary
-
#[](id)
Method used to get a model by id
-
#all
Get all the models in the repository
- #container
-
#delete(model : T)
execute the do_delete method and call model.after_delete if defined
-
#do_after_delete(model : T, *args)
check if the method after_delete exists and call it
-
#do_after_insert(model : T, *args)
check if the method after_insert exists and call it
-
#do_after_update(model : T, *args)
check if the method after_update exists and call it
-
#do_delete(model : T, *args)
execute delete
-
#do_insert(model : T, *args)
execute insert operation
-
#do_update(model : T, *args)
execute update
-
#insert(model : T)
execute the do_insert method and call model.after_insert if defined
-
#update(model : T)
execute the do_update method and call model.after_update if defined
Macro Summary
- commands(*methods)
-
def_repo_method(name)
macro used to define insert, update, delete methods
Constructor Detail
Class Method Detail
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