dba

package
v0.0.0-...-b1e697f Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPermissionsForUser

func AddPermissionsForUser(ctx context.Context, dbtx DBTX, id int64, codes model.PermissionCodes) error

func AttachBeanAssociations

func AttachBeanAssociations(ctx context.Context, dbtx DBTX, bean *model.BeanDB) error

func AttachManyBeanAssociations

func AttachManyBeanAssociations(ctx context.Context, dbtx DBTX, beans []*model.BeanDB) error

func AttachManyRoasterAssociations

func AttachManyRoasterAssociations(ctx context.Context, dbtx DBTX, roasters []*model.RoasterDB) error

func AttachRoasterAssociations

func AttachRoasterAssociations(ctx context.Context, dbtx DBTX, roaster *model.RoasterDB) error

func CreateBean

func CreateBean(ctx context.Context, dbtx DBTX, p *model.BeanCreateParams) (*model.BeanDB, error)

func CreateRoaster

func CreateRoaster(ctx context.Context, dbtx DBTX, p *model.RoasterCreateParams) (*model.RoasterDB, error)

func CreateUser

func CreateUser(ctx context.Context, dbtx DBTX, p *model.UserCreateParams) (*model.UserDB, error)

func DeleteBean

func DeleteBean(ctx context.Context, dbtx DBTX, id int64) error

func DeleteRoaster

func DeleteRoaster(ctx context.Context, dbtx DBTX, id int64) error

func FindBeans

func FindBeans(ctx context.Context, dbtx DBTX, p *model.BeanFilterParams) ([]*model.BeanDB, error)

func FindRoasters

func FindRoasters(ctx context.Context, dbtx DBTX, p *model.RoasterFilterParams) ([]*model.RoasterDB, error)

func GetBean

func GetBean(ctx context.Context, dbtx DBTX, id int64) (*model.BeanDB, error)

func GetBeansForRoaster

func GetBeansForRoaster(ctx context.Context, dbtx DBTX, id int64) ([]*model.BeanDB, error)

TODO: move this functionality into FindBeans

func GetPermissionsForUser

func GetPermissionsForUser(ctx context.Context, dbtx DBTX, id int64) (model.PermissionCodes, error)

func GetRoaster

func GetRoaster(ctx context.Context, dbtx DBTX, id int64) (*model.RoasterDB, error)

func GetUser

func GetUser(ctx context.Context, dbtx DBTX, id int64) (*model.UserDB, error)

func GetUserByEmail

func GetUserByEmail(ctx context.Context, dbtx DBTX, email string) (*model.UserDB, error)

func UpdateBean

func UpdateBean(ctx context.Context, dbtx DBTX, p *model.BeanEditParams) (*model.BeanDB, error)

func UpdateRoaster

func UpdateRoaster(ctx context.Context, dbtx DBTX, p *model.RoasterEditParams) (*model.RoasterDB, error)

func UserExists

func UserExists(ctx context.Context, dbtx DBTX, id int64) (bool, error)

Types

type DBTX

type DBTX interface {
	Exec(query string, args ...any) (sql.Result, error)
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
	Query(query string, args ...any) (*sql.Rows, error)
	QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
	QueryRow(query string, args ...any) *sql.Row
	QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}

Jump to

Keyboard shortcuts

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