struct

Lustra::Interval

Inherits Struct < Value < Object

It can be converted automatically from/to a interval column.

Usage example

class MyModel
  include Lustra::Model

  column interval : Lustra::TimeInDay
end

interval = Lustra::Interval.new(60.days)
record = MyModel.create!(interval: interval)

Constructors

new(months : Int32 = 0, days : Int32 = 0, hours : Int32 = 0, minutes : Int32 = 0, seconds : Int32 = 0, milliseconds : Int32 = 0, microseconds : Int64 = 0)
Source
new(months : Int32, days : Int32, microseconds : Number)

For PG::Interval

Source
new(span : Time::Span)
Source
new(io : IO)
Source

Class methods

decode(x : Slice(UInt8))
Source

Instance methods

+(interval : self)
Source
days
Source
hours
Source
microseconds
Source
milliseconds
Source
minutes
Source
months
Source
seconds
Source
to_json(json : JSON::Builder) : Nil
Source
to_s(io)
Source
to_sql
Source

Nested types