sync

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 19 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").

Types

type ConditionResult added in v0.16.0

type ConditionResult struct {
	FlagsUpdated int
	Warnings     []string
}

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

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