sqlboiler-addons

command module
v0.0.0-...-21c2c63 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2021 License: MIT Imports: 6 Imported by: 0

README

Addons for SQLBoiler

Editor

Generate editor classes to avoid boring column list in inserts/updates (especially if we want to process empty strings, false values, zero numbers).

Without editors
apiKey, err := models.FindAPIKey(ctx, s.db, keyID)
if err != nil {
	...
}
apiKey.Disabled = r.Disabled
apiKey.Title = r.Title
_, err = apiKey.Update(ctx, s.db, boil.Whitelist(models.APIKeyColumns.Disabled, models.APIKeyColumns.Title))
With editors
apiKey, err := models.FindAPIKey(ctx, s.db, keyID)
if err != nil {
	...
}
_, err = apiKey.E().SetDisabled(r.Disabled).SetTitle(r.Title).Update(ctx, s.db)
With editors (multiline)
apiKey, err := models.FindAPIKey(ctx, s.db, keyID)
if err != nil {
	...
}
_, err = apiKey.E().
	SetDisabled(r.Disabled).
	SetTitle(r.Title).
	Update(ctx, s.db)
Additional details

The cancelled PR New "editor" helper to avoid column lists for simple inserts/updates

Usage
./sqlboiler-addons PATH_TO_MODEL_DIRECTORY

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL