clear v0.7 Release Notes

Release Date: 2019-05-28 // about 3 years ago
  • v0.7

    ๐Ÿ”‹ Features

    • โž• Add Clear::Interval type

    This type is related to the type Clear::Interval of PostgreSQL. It stores month, days and microseconds and can be used
    with Time (Postgres' datetime) by adding or substracting it.

    Examples:

    Usage in Expression engine:

    interval = Clear::Interval.new(months: 1, days: 1)MyModel.query.where{ created\_at - interval \> updated\_at }.each do |model| # ...end
    

    ๐Ÿšš It might be used as column definition, and added / removed to crystal Time object

    class MyModelinclude Clear::Model column i : Clear::Intervalendputs "Expected time: #{Time.now + MyModel.first!.i}"
    
    • โž• Add Clear::TimeInDay columns type, which stands for the time object in PostgreSQL.

    Examples:

    Usage as stand alone:

    time = Clear::TimeInDay.parse("12:33")puts time.hour # 12puts time.minutes # 0Time.now.at(time) # Today at 12:33:00time.to\_s # 12:33:00time.to\_s(false) # don't show seconds =\> 12:33time = time + 2.minutes #12:35
    

    As with Interval, you might wanna use it as a column (use underlying time type in PostgreSQL):

    class MyModelinclude Clear::Model column i : Clear::TimeInDayend
    

    ๐Ÿ› Bug fixes