|
1 | 1 | # master/HEAD |
2 | 2 |
|
| 3 | +To be continued 😁 |
| 4 | + |
| 5 | +# v0.4 |
| 6 | + |
3 | 7 | ## Features |
4 | 8 | - Improved Model build/create methods, allowing to pass arguments instead of NamedTuple |
| 9 | +- #48 Add `lateral join` feature: |
| 10 | + ```crystal |
| 11 | + Model.query.left_join("other_model", lateral: true){ model.id == other_model.model_id } |
| 12 | + ``` |
| 13 | +- #35 Add methods `import` over collection, to be able to insert multiple objects with one query: |
| 14 | + ```crystal |
| 15 | + user_array = 10.times.map{ |x| User.new(name: "user#{x}") } |
| 16 | + Model.import(user_array) |
| 17 | + ``` |
| 18 | +- #42 Add support of `ON CONFLICT` both in `Insert` and `Model#save` |
| 19 | + ```crystal |
| 20 | + u = User.new(id: 1, first_name: "me") |
| 21 | + u.save! &.on_conflict("(id)").do_update(&.set("first_name = excluded.first_name").where { model_users.id == excluded.id }) |
| 22 | + ``` |
| 23 | + - Note: Method `Model#import` explained above can use the same syntax to resolve conflict. |
| 24 | + This will helps to use Clear for import, CSV and batch processing. |
| 25 | +- #26 Add `to_json` supports to model. Please note that some core lib and shards `pg` objects got |
| 26 | + extended to allow this support: |
| 27 | + - By default, undefined fields are not exported. To export all columns even thoses which are not fetched in SQL, use `full: true`. For example: |
| 28 | + ``` |
| 29 | + User.query.first!.to_json # => {"id":1, "first_name":"Louis", "last_name": "XVI"} |
| 30 | + User.query.select("id, first_name").first!.to_json # => {"id":1, "first_name":"Louis"} |
| 31 | + User.query.select("id, first_name").first!.to_json(full: true) # => {"id":1, "first_name":"Louis", "last_name": null} |
| 32 | + ``` |
5 | 33 |
|
6 | 34 | ## Bug fixes |
7 | 35 | - Escaping table, columns and schema name to allow Clear to works on any SQL restricted names. |
8 | 36 | - This is very demanding work as it turns out table and columns naming are used everywhere |
9 | 37 | in the ORM. Please give me feedback in case of any issues ! |
10 | | -- Fix #31, #36, #37 |
| 38 | +- Fix #31, #36, #38, #37 |
11 | 39 | - Fix issue with polymorphic table |
12 | 40 |
|
13 | 41 | ## Breaking changes |
|
24 | 52 | where{ raw("a.b") } |
25 | 53 | ``` |
26 | 54 | TL;DR, if you currently use `var` function, please use `raw` instead from now. |
| 55 | +- Revamping the converter system, allowing to work seemlessly with complexes types like Union and Generic |
| 56 | + - Documentation will follow soon. |
| 57 | +
|
| 58 | +# v0.3.1 |
| 59 | +
|
| 60 | +Basically a transition version, to support Crystal 0.27. Some of the features of 0.4 were deployed already in 0.3.1. See above for the new features/changes. |
27 | 61 |
|
28 | 62 | # v0.3 |
29 | 63 |
|
|
0 commit comments