sync

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 8 Imported by: 0

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

func FlagTypeString(ft pbflagsv1.FlagType) string

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

func LayerDBString(layer string) string

LayerDBString normalizes the layer name for DB storage (uppercase). Empty or "global" maps to "GLOBAL".

Types

type Result

type Result struct {
	Features      int
	FlagsUpserted int
	FlagsArchived int
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL