Fix path i nreadme, add boil.SetDB

This commit is contained in:
Patrick O 2016-09-17 14:12:37 +10:00 committed by GitHub
parent e1d9ac3d17
commit 6903b4756e

View file

@ -91,12 +91,12 @@ Table of Contents
- Relationships/Associations
- Eager loading (recursive)
- Custom struct tags
- Schema support
- Transactions
- Raw SQL fallback
- Compatibility tests (Run against your own DB schema)
- Debug logging
- Postgres 1d arrays, json, hstore & more
- Schemas support
- 1d arrays, json, hstore & more
### Supported Databases
@ -112,7 +112,7 @@ For a comprehensive list of available operations and examples please see [Featur
```go
import (
// Import this so we don't have to use qm.Limit etc.
. "github.com/vattle/sqlboiler/boil/qm"
. "github.com/vattle/sqlboiler/queries/qm"
)
// Open handle to database like normal
@ -121,6 +121,12 @@ if err != nil {
return err
}
// If you don't want to pass in db to all generated methods
// you can use boil.SetDB to set it globally, and then use
// the G variant methods like so:
boil.SetDB(db)
users, err := models.UsersG().All()
// Query all users
users, err := models.Users(db).All()