struct Clear::Interval

Overview

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

Usage example

class MyModel
  include Clear::Model

  column interval : Clear::TimeInDay
end

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

Defined in:

clear/extensions/interval/interval.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(months : Int32 = 0, days : Int32 = 0, hours : Int32 = 0, minutes : Int32 = 0, seconds : Int32 = 0, milliseconds : Int32 = 0, microseconds : Int64 = 0) #

[View source]
def self.new(months : Int32, days : Int32, microseconds : Number) #

[View source]
def self.new(span : Time::Span) #

[View source]
def self.new(span : Time::MonthSpan) #

[View source]
def self.new(io : IO) #

[View source]

Class Method Detail

def self.decode(x : Slice(UInt8)) #

[View source]

Instance Method Detail

def +(interval : self) #

[View source]
def days : Int32 #

[View source]
def hours : Int32 #

[View source]
def microseconds : Int64 #

[View source]
def milliseconds : Int32 #

[View source]
def minutes : Int32 #

[View source]
def months : Int32 #

[View source]
def seconds : Int32 #

[View source]
def to_json(json : JSON::Builder) : Nil #

[View source]
def to_s(io) #

[View source]
def to_sql #

[View source]