shredbx logo
shredbx shredbx shredbx shredbx Personal
  • Home
  • Lab
  • Portfolio
  • Experience
  • Services
  • Profile
  • Contact
AClaude
  • Home
  • Lab
  • Portfolio
  • Experience
  • Services
  • Profile
  • Contact
Andrei Solovev
Packages
Search packages... ⌘K
  • Data & Persistence
    • Databases 3
    • Object Storage 1
    • File Formats 2
    • Enumerations 2
    • Content 1
    • Codegen 2
  • System Integration
    • Secrets 1
    • CLI Tools 5
    • Media Processing 2
    • Adapters 2
  • UI & Components
    • Primitives 1
    • Blocks 1
    • Sections & Layouts 1
    • Entities 1
    • Media 1
    • Utilities 1
    • State & Presenter 1
    • Branding & Style 1
  • Game Engine
    • Framework 1
    • Engine 2
    • Presets 1
    • Vendor 1
Packages/ Data & Persistence/ Enumerations/ Dictionary
Go Package

dictionary

Two-tier dictionary sync — YAML-defined enumerations with database sync

Go Ready MD
Dictionary Definition and Sync go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Define enumerations in YAML, load into typed dictionaries
statuses := dictionary.Dictionary{
    Name:  "project_status",
    Table: "lookup_project_status",
    Entries: []dictionary.Entry{
        {Code: "draft", Label: "Draft", Order: 1},
        {Code: "active", Label: "Active", Order: 2},
        {Code: "archived", Label: "Archived", Order: 3},
    },
}

// Sync to database — inserts new, updates changed, preserves extras
err := dictionary.Sync(ctx, pool, statuses)

// Fast in-memory lookup
entry, ok := statuses.Lookup("active")
// entry.Label == "Active"

About

Manages enumeration values defined in YAML files and synchronized to database lookup tables. Supports two-tier resolution: fast in-memory lookup from YAML with database as the authoritative store for runtime additions.

Public API

NameKindSignature
Dictionarytypetype Dictionary struct
Entrytypetype Entry struct
Syncfuncfunc Sync(ctx context.Context, pool *database.Pool, dicts ...Dictionary) error
Lookupfuncfunc (d *Dictionary) Lookup(code string) (*Entry, bool)

Dependencies

Imports (1)

database Go Ready

PostgreSQL adapter — connection pooling, schema isolation, health checks

postgresqlpgxpoolingschema-isolation
4 exports 5 deps

Imported By (1)

catalogue Go Ready

Hierarchical catalogue — nested category trees with path-based lookup

hierarchytree-structurecategoriespath-lookup
5 exports 1 deps

Related Packages

catalogue Go Ready

Hierarchical catalogue — nested category trees with path-based lookup

hierarchytree-structurecategoriespath-lookup
5 exports 1 deps
database Go Ready

PostgreSQL adapter — connection pooling, schema isolation, health checks

postgresqlpgxpoolingschema-isolation
4 exports 5 deps

Source

github.com/shredbx/sbx-core/pkg/dictionary
enumerationslookup-tablesyaml-synctwo-tier
shredbx logo shredbx shredbx shredbx shredbx Andrei Solovev

Solution Architect & Lead Software Engineer

ExperiencePortfolioResearch & ExperimentsEducationCertificationSkills
GitHub ↗LinkedIn ↗Email ↗
AVAILABLE FOR NEW PROJECTS
// MY LATEST BEATS
Hobby & Interests

Lab

  • The Lab
  • Framework
  • Components
  • Packages
  • Games
  • Process (SDLC)
  • Knowledge
  • Blog

Andrei

  • Portfolio
  • Experience
  • Services
  • Profile
  • Contact
  • Lifestyle

Team

  • Team
  • Andrei
  • Claude

Legal

  • Privacy
  • Terms
  • Cookies
© 2026 shredbx.com. All rights reserved. — Andrei Solovev |