class

Marten::DB::Field::DateTime

Inherits Marten::DB::Field::Base / Reference / Object

Constructors

new(id : ::String, primary_key = false, default : Time | Nil = nil, blank = false, null = false, unique = false, index = false, db_column = nil, auto_now : ::Bool = false, auto_now_add : ::Bool = false)
Source

Instance methods

auto_now
Source
auto_now?

Returns a boolean indicating if the field automatically sets the current time at record save time.

Source
auto_now_add
Source
auto_now_add?

Returns a boolean indicating if the field automatically sets the current time at record creation time.

Source
default

Returns the default value of the field if any.

Source
from_db(value) : Time | Nil

Converts the raw DB value to the corresponding field value.

Source
from_db_result_set(result_set : ::DB::ResultSet) : Time | Nil

Extracts the field value from a DB result set and returns the right object corresponding to this value.

Source
prepare_save(record, new_record = false)

Runs pre-save logic for the specific field and record at hand.

This method does nothing by default but can be overridden for specific fields that need to set values on the model instance before save or perform any pre-save logic.

Source
to_column

Returns a migration column object corresponding to the field at hand.

Source
to_db(value) : ::DB::Any

Converts the field value to the corresponding DB value.

Source