module Marten::DB::Model::Table

Direct including types

Defined in:

marten/db/model/table.cr

Macro Summary

Instance Method Summary

Macro Detail

macro field(*args, **kwargs) #

[View source]

Instance Method Detail

def get_field_value(field_name : String | Symbol) #

Allows to read the value of a specific field.

This methods returns the value of the field corresponding to field_name. If the passed field_name doesn't match any existing field, a Marten::DB::Errors::UnknownField exception is raised.


[View source]
def inspect(io) #

[View source]
def pk #

Returns the primary key value.


[View source]
def pk! #

Returns the primary key value or raise NilAssertionError.


[View source]
def pk=(val) #

Allows to set the primary key value.


[View source]
def set_field_value(field_name : String | Symbol, value : Field::Any | Model) #

Allows to set the value of a specific field.

If the passed field_name doesn't match any existing field, a Marten::DB::Errors::UnknownField exception will be raised.


[View source]
def set_field_values(values : Hash | NamedTuple) #

Allows to set the values of multiple fields.

If one of the specified field names doesn't match any existing field, a Marten::DB::Errors::UnknownField exception will be raised.


[View source]
def set_field_values(**values) #

Allows to set the values of multiple fields.

If one of the specified field names doesn't match any existing field, a Marten::DB::Errors::UnknownField exception will be raised.


[View source]
def to_s(io) #

[View source]