SQLBoiler is a tool to generate a Go ORM tailored to your database schema.
5360d3094e
In general: errors.New("thing") -> errors.New fmt.Errorf("thing %s", arg) -> errors.Errorf fmt.Errorf("thing %v", err) -> errors.Wrap fmt.Errorf("thing %s %v", arg, err) -> errors.Wrapf |
||
---|---|---|
bdb | ||
boil | ||
strmangle | ||
templates | ||
templates_test | ||
testdata | ||
.gitignore | ||
circle.yml | ||
config.go | ||
imports.go | ||
imports_test.go | ||
LICENSE.md | ||
main.go | ||
output.go | ||
output_test.go | ||
README.md | ||
sqlboiler.go | ||
sqlboiler_test.go | ||
templates.go | ||
templates_test.go | ||
text_helpers.go | ||
text_helpers_test.go |
SQLBoiler
SQLBoiler is a tool to generate a Go ORM tailored to your database schema.
Config
config.toml
[postgres]
host="localhost"
port=5432
user="dbusername"
pass="dbpassword"
dbname="dbname"
How
SQLBoiler connects to your database (defined in your config.toml file) to ascertain the structure of your tables, and builds your Go ORM code using the templates defined in the /templates
folder.
Running SQLBoiler without the --table
flag will result in SQLBoiler building boilerplate code for every table in your database marked as public
.
Before you use SQLBoiler make sure you create a config.toml
configuration file with your database details, and specify your database by using the --driver
flag.
Usage:
sqlboiler [flags]
Flags:
-d, --driver string The name of the driver in your config.toml (mandatory)
-f, --folder string The name of the output folder (default "output")
-p, --pkgname string The name you wish to assign to your generated package (default "model")
-t, --table string A comma seperated list of table names (generates all tables if not provided)