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]userconfig.View, error)
- func (d DB) GetAllRulesConfigs(ctx context.Context) (map[string]userconfig.VersionedRulesConfig, error)
- func (d DB) GetConfig(ctx context.Context, userID string) (userconfig.View, error)
- func (d DB) GetConfigs(ctx context.Context, since userconfig.ID) (map[string]userconfig.View, error)
- func (d DB) GetRulesConfig(ctx context.Context, userID string) (userconfig.VersionedRulesConfig, error)
- func (d DB) GetRulesConfigs(ctx context.Context, since userconfig.ID) (map[string]userconfig.VersionedRulesConfig, error)
- func (d DB) RestoreConfig(ctx context.Context, userID string) error
- func (d DB) SetConfig(ctx context.Context, userID string, cfg userconfig.Config) error
- func (d DB) SetDeletedAtConfig(ctx context.Context, userID string, deletedAt pq.NullTime, ...) error
- func (d DB) SetRulesConfig(ctx context.Context, userID string, ...) (bool, error)
- func (d DB) Transaction(f func(DB) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct { squirrel.StatementBuilderType // contains filtered or unexported fields }
DB is a postgres db, for dev and production
func (DB) DeactivateConfig ¶
DeactivateConfig deactivates a configuration.
func (DB) GetAllConfigs ¶
GetAllConfigs gets all of the userconfig.
func (DB) GetAllRulesConfigs ¶
func (d DB) GetAllRulesConfigs(ctx context.Context) (map[string]userconfig.VersionedRulesConfig, error)
GetAllRulesConfigs gets all alertmanager configs for all users.
func (DB) GetConfigs ¶
func (d DB) GetConfigs(ctx context.Context, since userconfig.ID) (map[string]userconfig.View, error)
GetConfigs gets all of the configs that have changed recently.
func (DB) GetRulesConfig ¶
func (d DB) GetRulesConfig(ctx context.Context, userID string) (userconfig.VersionedRulesConfig, error)
GetRulesConfig gets the latest alertmanager config for a user.
func (DB) GetRulesConfigs ¶
func (d DB) GetRulesConfigs(ctx context.Context, since userconfig.ID) (map[string]userconfig.VersionedRulesConfig, error)
GetRulesConfigs gets all the alertmanager configs that have changed since a given config.
func (DB) RestoreConfig ¶
RestoreConfig restores configuration.
func (DB) SetDeletedAtConfig ¶
func (d DB) SetDeletedAtConfig(ctx context.Context, userID string, deletedAt pq.NullTime, cfg userconfig.Config) error
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 userconfig.RulesConfig) (bool, error)
SetRulesConfig sets the current alertmanager config for a user.