Skip to content

falconandy/sqlboiler-addons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Addons for SQLBoiler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages