Vlaд Фaуsт
Vlaд Фaуsт
Useful to query `Onyx::SQL::Serializable` objects with built queries.
Use-case – unknown structure JSON: ```crystal type payload : Hash(String, String), converter: PG::JSONB(Hash(String, String)) ``` Or unique enumerables as set: ```crystal type tags : Set(String), converter: PG::Set(String) ```
I do have code which requires models to be sorted persistently in different places. Primary key could act as a comparator value, even if it's UUID. See https://github.com/crystal-lang/crystal/pull/6611.
```crystal post = Post.where(id: 1).join(:author) { |x| x.select(:id, :name) } pp post # ``` Should work without `:id`.
Would build to `WHERE field > a AND field < b`. Should raise if the type is neither `Number` nor `Time`.
```crystal class Article schema articles do type tags : Array(Tag), through: TagRelation, foreign_key: "article_id" end end class Tag schema tags do type value : String type articles : Array(Article), through:...
Either change the error message from `Cannot append empty INSERT values. Ensure to call #insert before. Or if you want to insert all columns default, use 'INSERT INTO table DEFAULT...
```crystal 2.times do spawn do Onyx::SQL.transaction do |tx| sleep(rand) Onyx::SQL.query # Which tx is it using now – the first or the second one? end end end ``` Proposed API:...