Documentation ¶
Index ¶
- type DB
- func (db *DB) CreateTx(ctx context.Context, tx *sql.Tx, n *NotificationRule) (*NotificationRule, error)
- func (db *DB) Delete(ctx context.Context, id string) error
- func (db *DB) DeleteTx(ctx context.Context, tx *sql.Tx, ids ...string) error
- func (d *DB) DoTx(f func(Store) error) error
- func (db *DB) FindAll(ctx context.Context, userID string) ([]NotificationRule, error)
- func (db *DB) FindOne(ctx context.Context, id string) (*NotificationRule, error)
- func (db *DB) Insert(ctx context.Context, n *NotificationRule) (*NotificationRule, error)
- func (db *DB) UpdateDelay(ctx context.Context, id string, delay int) error
- func (db *DB) WrapTx(tx *sql.Tx) Store
- type NotificationRule
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB implements the NotificationRuleStore against a *sql.DB backend.
func NewDB ¶
NewDB will create a DB backend from a sql.DB. An error will be returned if statements fail to prepare.
func (*DB) CreateTx ¶
func (db *DB) CreateTx(ctx context.Context, tx *sql.Tx, n *NotificationRule) (*NotificationRule, error)
CreateTx implements the NotificationRuleStore interface by inserting the new NotificationRule into the database. A new ID is always created.
func (*DB) Insert ¶
func (db *DB) Insert(ctx context.Context, n *NotificationRule) (*NotificationRule, error)
Insert implements the NotificationRuleStore interface by inserting the new NotificationRule into the database. A new ID is always created.
func (*DB) UpdateDelay ¶
Update implements the NotificationRuleStore interface.
type NotificationRule ¶
type NotificationRule struct { ID string `json:"id"` UserID string `json:"-"` DelayMinutes int `json:"delay"` ContactMethodID string `json:"contact_method_id"` }
func (NotificationRule) Normalize ¶
func (n NotificationRule) Normalize(update bool) (*NotificationRule, error)
type Store ¶
type Store interface { Insert(context.Context, *NotificationRule) (*NotificationRule, error) UpdateDelay(ctx context.Context, id string, delay int) error Delete(ctx context.Context, id string) error DeleteTx(ctx context.Context, tx *sql.Tx, ids ...string) error CreateTx(context.Context, *sql.Tx, *NotificationRule) (*NotificationRule, error) FindOne(ctx context.Context, id string) (*NotificationRule, error) FindAll(ctx context.Context, userID string) ([]NotificationRule, error) WrapTx(*sql.Tx) Store DoTx(func(Store) error) error }
Store allows the lookup and management of NotificationRules.
Click to show internal directories.
Click to hide internal directories.