abstract class PlaceOS::Model::ModelWithAutoKey

Overview

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk

Included Modules

Direct Known Subclasses

Defined in:

placeos-models/base/model.cr

Constant Summary

CALLBACKS = {before_save: [] of Nil, after_save: [] of Nil, before_create: [] of Nil, after_create: [] of Nil, before_update: [] of Nil, after_update: [] of Nil, before_destroy: [] of Nil, after_destroy: [] of Nil}

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

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

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


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

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def self.new(rs : DB::ResultSet) #

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]

Class Method Detail

def self.attributes : Array(Symbol) #

Returns all attribute keys.


def self.auto_generate_id : Bool #

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


def self.from_rs(rs : DB::ResultSet) #

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def self.primary_key : Symbol #

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


Instance Method Detail

def after_create #

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def after_destroy #

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def after_save #

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def after_update #

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def apply_defaults #

Generate code to apply default values


def assign_attributes(params : HTTP::Params | Hash(String, String) | Tuple(String, String)) #

Assign to mulitple attributes via HTTP::Params.


def assign_attributes(model : PlaceOS::Model::ModelWithAutoKey) #

Assign to multiple attributes from a model object


def assign_attributes #

Assign to multiple attributes.


def attributes #

Returns a Hash of all attribute values


def attributes_tuple #

Returns a NamedTuple of all attribute values.


def before_create #

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def before_destroy #

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def before_save #

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def before_update #

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def invoke_props #

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


def persistent_attributes #

Returns a Hash of all attributes that can be persisted.


def run_create_callbacks(&) #

Wrap a block with callbacks for the appropriate crud operation


[View source]
def run_destroy_callbacks(&) #

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def run_save_callbacks(&) #

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def run_update_callbacks(&) #

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]