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").
func LayerDBString ¶
LayerDBString normalizes the layer name for DB storage (uppercase). Empty or "global" maps to "GLOBAL".
Types ¶
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.