Skip to content

Commit

Permalink
V0.4 (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
anykeyh authored Nov 12, 2018
1 parent 8f0695e commit db9da98
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
36 changes: 35 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,41 @@
# master/HEAD

To be continued 😁

# v0.4

## Features
- Improved Model build/create methods, allowing to pass arguments instead of NamedTuple
- #48 Add `lateral join` feature:
```crystal
Model.query.left_join("other_model", lateral: true){ model.id == other_model.model_id }
```
- #35 Add methods `import` over collection, to be able to insert multiple objects with one query:
```crystal
user_array = 10.times.map{ |x| User.new(name: "user#{x}") }
Model.import(user_array)
```
- #42 Add support of `ON CONFLICT` both in `Insert` and `Model#save`
```crystal
u = User.new(id: 1, first_name: "me")
u.save! &.on_conflict("(id)").do_update(&.set("first_name = excluded.first_name").where { model_users.id == excluded.id })
```
- Note: Method `Model#import` explained above can use the same syntax to resolve conflict.
This will helps to use Clear for import, CSV and batch processing.
- #26 Add `to_json` supports to model. Please note that some core lib and shards `pg` objects got
extended to allow this support:
- By default, undefined fields are not exported. To export all columns even thoses which are not fetched in SQL, use `full: true`. For example:
```
User.query.first!.to_json # => {"id":1, "first_name":"Louis", "last_name": "XVI"}
User.query.select("id, first_name").first!.to_json # => {"id":1, "first_name":"Louis"}
User.query.select("id, first_name").first!.to_json(full: true) # => {"id":1, "first_name":"Louis", "last_name": null}
```

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

## Breaking changes
Expand All @@ -24,6 +52,12 @@
where{ raw("a.b") }
```
TL;DR, if you currently use `var` function, please use `raw` instead from now.
- Revamping the converter system, allowing to work seemlessly with complexes types like Union and Generic
- Documentation will follow soon.
# v0.3.1
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.
# v0.3
Expand Down
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: clear
version: 0.3.1
version: 0.4

authors:
- Yacine Petitprez <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion src/clear/version.cr
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Clear
VERSION = "v0.3.1"
VERSION = "v0.4"
end

0 comments on commit db9da98

Please sign in to comment.