Skip to content

Commit db9da98

Browse files
authored
V0.4 (#51)
1 parent 8f0695e commit db9da98

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

CHANGELOG.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,41 @@
11
# master/HEAD
22

3+
To be continued 😁
4+
5+
# v0.4
6+
37
## Features
48
- 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+
```
533

634
## Bug fixes
735
- Escaping table, columns and schema name to allow Clear to works on any SQL restricted names.
836
- This is very demanding work as it turns out table and columns naming are used everywhere
937
in the ORM. Please give me feedback in case of any issues !
10-
- Fix #31, #36, #37
38+
- Fix #31, #36, #38, #37
1139
- Fix issue with polymorphic table
1240

1341
## Breaking changes
@@ -24,6 +52,12 @@
2452
where{ raw("a.b") }
2553
```
2654
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.
2761
2862
# v0.3
2963

shard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: clear
2-
version: 0.3.1
2+
version: 0.4
33

44
authors:
55
- Yacine Petitprez <anykeyh@gmail.com>

src/clear/version.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Clear
2-
VERSION = "v0.3.1"
2+
VERSION = "v0.4"
33
end

0 commit comments

Comments
 (0)