Documentation ¶
Overview ¶
Package db contains show related CRUD functionality.
Index ¶
- type Show
- type Store
- func (s Store) Create(ctx context.Context, show Show) error
- func (s Store) Delete(ctx context.Context, showIDList []string) error
- func (s Store) Query(ctx context.Context, pageNumber int, rowsPerPage int) ([]Show, error)
- func (s Store) QueryAllEnabled(ctx context.Context) ([]Show, error)
- func (s Store) QueryByID(ctx context.Context, showID string) (Show, error)
- func (s Store) TotalNum(ctx context.Context) (int64, error)
- func (s Store) Tran(tx sqlx.ExtContext) Store
- func (s Store) Update(ctx context.Context, show Show) error
- func (s Store) WithinTran(ctx context.Context, fn func(sqlx.ExtContext) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Show ¶
type Show struct { ID string `db:"show_id"` Enable bool `db:"enable"` Platform string `db:"platform"` RoomID string `db:"room_id"` StreamerName string `db:"streamer_name"` OutTmpl string `db:"out_tmpl"` Parser string `db:"parser"` SaveDir string `db:"save_dir"` PostCmds string `db:"post_cmds"` SplitRule string `db:"split_rule"` DateCreated time.Time `db:"date_created"` DateUpdated time.Time `db:"date_updated"` }
Show represent the structure we need for moving data between the app and the database.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages the set of APIs for show access.
func NewStore ¶
func NewStore(log *zap.SugaredLogger, db *sqlx.DB) Store
NewStore constructs a data for api access.
func (Store) QueryAllEnabled ¶
QueryAllEnabled retrieves all shows which `enable` equals true from the database.
func (Store) Tran ¶
func (s Store) Tran(tx sqlx.ExtContext) Store
Tran return new Store with transaction in it.
func (Store) WithinTran ¶
WithinTran runs passed function and do commit/rollback at the end.
Click to show internal directories.
Click to hide internal directories.