Documentation ¶
Index ¶
- type DB
- func (d *DB) Close() error
- func (d *DB) DeactivateConfig(ctx context.Context, userID string) error
- func (d *DB) GetAllConfigs(ctx context.Context) (map[string]configs.View, error)
- func (d *DB) GetAllRulesConfigs(ctx context.Context) (map[string]configs.VersionedRulesConfig, error)
- func (d *DB) GetConfig(ctx context.Context, userID string) (configs.View, error)
- func (d *DB) GetConfigs(ctx context.Context, since configs.ID) (map[string]configs.View, error)
- func (d *DB) GetRulesConfig(ctx context.Context, userID string) (configs.VersionedRulesConfig, error)
- func (d *DB) GetRulesConfigs(ctx context.Context, since configs.ID) (map[string]configs.VersionedRulesConfig, error)
- func (d *DB) RestoreConfig(ctx context.Context, userID string) error
- func (d *DB) SetConfig(ctx context.Context, userID string, cfg configs.Config) error
- func (d *DB) SetDeletedAtConfig(ctx context.Context, userID string, deletedAt time.Time) error
- func (d *DB) SetRulesConfig(ctx context.Context, userID string, oldConfig, newConfig configs.RulesConfig) (bool, error)
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 is an in-memory database for testing, and local development
func (*DB) DeactivateConfig ¶
DeactivateConfig deactivates configuration for a user by creating new configuration with DeletedAt set to now
func (*DB) GetAllConfigs ¶
GetAllConfigs gets all of the configs.
func (*DB) GetAllRulesConfigs ¶
func (d *DB) GetAllRulesConfigs(ctx context.Context) (map[string]configs.VersionedRulesConfig, error)
GetAllRulesConfigs gets the rules configs for all users that have them.
func (*DB) GetConfigs ¶
GetConfigs gets all of the configs that have changed recently.
func (*DB) GetRulesConfig ¶
func (d *DB) GetRulesConfig(ctx context.Context, userID string) (configs.VersionedRulesConfig, error)
GetRulesConfig gets the rules config for a user.
func (*DB) GetRulesConfigs ¶
func (d *DB) GetRulesConfigs(ctx context.Context, since configs.ID) (map[string]configs.VersionedRulesConfig, error)
GetRulesConfigs gets the rules configs that have changed since the given config version.
func (*DB) RestoreConfig ¶
RestoreConfig restores deactivated configuration for a user by creating new configuration with empty DeletedAt
func (*DB) SetDeletedAtConfig ¶
SetDeletedAtConfig sets a deletedAt for configuration by adding a single new row with deleted_at set the same as SetConfig is actually insert
func (*DB) SetRulesConfig ¶
func (d *DB) SetRulesConfig(ctx context.Context, userID string, oldConfig, newConfig configs.RulesConfig) (bool, error)
SetRulesConfig sets the rules config for a user.