good morning!!!!

Skip to content
Snippets Groups Projects
Commit 6e39d2f5 authored by José Carlos Nieto's avatar José Carlos Nieto
Browse files

Add a note on query builder behaviour change

parent 470e9beb
No related branches found
No related tags found
No related merge requests found
......@@ -86,6 +86,39 @@ go run _examples/booktown-books/main.go
2016/08/10 08:42:48 "Practical PostgreSQL" (ID: 41472)
```
## Changeog
Dec 15th, 2016: Before `2.0.0-rc8`, upper-db produced queries that mutated
themselves:
```
q := sess.SelectFrom("users")
q.Where(...) // This method modified q's internal state.
```
Starting on `2.0.0-rc8` this is no longer valid, if you want to use values to
represent queries you'll have to reassign them, like this:
```
q := sess.SelectFrom("users")
q = q.Where(...)
q.And(...) // Nothing happens, the Where() method does not affect q.
```
This applies to all query builder methods, `db.Result`, `db.And` and `db.Or`.
If you want to check your code for statatements that might rely on the old
behaviour and could cause you trouble use `dbcheck`:
```
go get -u github.com/upper/cmd/dbcheck
dbcheck github.com/my/package/...
```
## License
This project is licensed under the terms of the **MIT License**.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment