Release 0.11.0
I'm happy to announce that the release supporting crystal >= 1.0.0
is published. Summarizing changelog below I'd like to emphasize next points:
- now models/views/record have
#to_json
method to simplify serialization - Jennifer supports latest mysql/postgresl/sqlite driver versions
- now string-based values can be used much easily with new coercing logic
- time zone related logic become more flexible and configurable
- now each pull request merge and release automatically rebuilds documentation so you always can check fresh version here
- currently i18n shard has a bit unstable support so may cause some issues (feel free to open issue if you face one)
Changelog
General
- add crystal
>= 1.0.0
support - fix inconsistent method signatures in multiple places
- add
#to_json
to the following structs:PG::Numeric
,PG::Geo::Point
,PG::Geo::Line
,PG::Geo::Circle
,PG::Geo::LineSegment
,PG::Geo::Box
,PG::Geo::Path
,PG::Geo::Polygon
,Char
,Time::Span
,Slice
,UUID
- add
crystal-mysql: 0.13.0
support - add
crystal-pg: 0.23.2
support
QueryBuilder
- add custom
#to_json
to serialize retrieved collection - add
#where
acceptingHash(Symbol, _)
- add
Criteria#equal
andCriteria#not_equal
as original implementation ofCriteria#==
andCriteria#!=
- add
ExpressionBuilder
#and
,#or
and#xor
methods that accepts array of conditions
Model
Authentication#password
returns given unecrypted value- add
Coercer
module with static methods to localize all coercing logic for different types - add
.coercer
method to return object responding to all coercing methods described inCoercer
mapping
generates.coerce_{{attribute}(value : String)
methods for every field to coerce string value toattribute
's typemapping
generates for every non-string attribute with a setter additional#{{attribute}}=(value : String)
setter- allow all build methods (
.new
,.create
and.update
) to receiveHash(String, String)
and coerce values to expected types - add
.column_name
to return all field names - fix
.field_names
from returning child's properties for parent class - add custom
#to_json
- change converter interface to
.from_db(DB::ResultSet, NamedTuple)
,.from_db(DB::ResultSet, NamedTuple)
and.from_hash(Hash, String | Symbol, NamedTuple)
- change all existing converters to support new required interface
- add
BigDecimalConverter(T)
converter - add
Coercer.coerce(String, (BigDecimal?).class)
- add
time_zone_aware
option forTimeZoneConverter
to specify whether field should respect time zone converting logic - add support of date only and time only string formats for
TimeZoneConverter
- add
time_format
,date_time_format
anddate_format
to customize time, date time and date formats respectively - fix a bug where updated_at is not set in the generated sql query from model.save
NumericToFloat64Converter
,BigDecimalConverter
,TimeZoneConverter
#from_hash
accepts string as field valueBigDecimalConverter#from_hash
accepts integer and float values as field value- fix
Errors#inspect
bug using oldUInt64#to_s
signature - introduce
Timestamp
module that now includeswith_timestamps
macro - reworked how
updated_at
andcreated_at
fields are set before save - now they are set explicitly without utilizing callbacks - add
Resource.where
acceptingHash(Symbol, _)
Validation
- change
Validator#validate
abstract interface to#validate(record, **opts)
- update all built-in validators to reflect new
Validator
interface - make
Validator.with_blank_validation
macro to accept arguments to reference record, field name, value and blank value acceptance
Relation
- remove abstract
#condition_clause
&#condition_clause(a)
declarations fromIRelation
View
- add custom
#to_json
Adapter
- remove abstract
#update
declaration fromBase
BaseSQLGenerator#parse_query
convertsTime
arguments to UTC only ifConfig.time_zone_aware_attributes
set totrue
Mysql#read_column
callssuper
if column isn't a tiny intResultParser#read_column
convert time toConfig.local_time_zone
ifConfig.time_zone_aware_attributes
set totrue
or just change time zone to it otherwise
Config
.reset_config
creates new instance instead of executing#initialize
on existing object- add
Config.time_zone_aware_attributes
to specify whether time zone converting logic should be globally disabled
Migration
- add
precision
andscale
options support fordecimal
data type
Record
- add custom
#to_json
- add custom
#inspect