Documentation
¶
Overview ¶
Package sync provides flag definition synchronization from parsed descriptors into PostgreSQL. Both pbflags-sync and pbflags-admin (standalone mode) use this package to write definitions to the database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FlagTypeString ¶
FlagTypeString converts a FlagType enum to the string stored in the DB, stripping the "FLAG_TYPE_" prefix (e.g. FLAG_TYPE_BOOL -> "BOOL").
Types ¶
type ConditionResult ¶ added in v0.16.0
ConditionResult reports what the condition sync did.
func SyncConditions ¶ added in v0.16.0
func SyncConditions( ctx context.Context, conn *pgx.Conn, configDir string, descriptorData []byte, defs []evaluator.FlagDef, logger *slog.Logger, sha string, ) (ConditionResult, error)
SyncConditions compiles YAML config files from configDir and writes conditions, dimension_metadata, and cel_version to the flags table.
type Result ¶
Result reports what the sync did.
func SyncDefinitions ¶
func SyncDefinitions(ctx context.Context, conn *pgx.Conn, defs []evaluator.FlagDef, logger *slog.Logger) (Result, error)
SyncDefinitions writes the given flag definitions to the database in a single transaction. It upserts features and flags, and archives flags that are no longer present in the descriptor. Runtime state (state, value) is never modified.