Documentation
¶
Index ¶
- func ApplyLocaleToRead(data map[string]any, cols map[string]*ingitdb.ColumnDef) map[string]any
- func ApplyLocaleToWrite(data map[string]any, cols map[string]*ingitdb.ColumnDef) map[string]any
- func CollectionForKey(def *ingitdb.Definition, id string) (*ingitdb.CollectionDef, string, error)
- func ParseMapOfIDRecordsContent(content []byte, format ingitdb.RecordFormat) (map[string]map[string]any, error)
- func ParseRecordContent(content []byte, format ingitdb.RecordFormat) (map[string]any, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyLocaleToRead ¶ added in v0.12.0
ApplyLocaleToRead transforms record data from file representation to application representation. For each column that has a Locale value set (e.g. column "title" with locale "en"), the paired map column (e.g. "titles") is inspected: the locale entry is extracted and exposed as the shortcut column ("title"), and that locale key is removed from the pair map to avoid duplication. The caller receives e.g. {"title": "Work", "titles": {"ru": "Работа"}}.
func ApplyLocaleToWrite ¶ added in v0.12.0
ApplyLocaleToWrite normalises record data before writing to file. For each column that has a Locale value set (e.g. column "title" with locale "en"):
- The shortcut column ("title") is stored as-is in the file.
- If the paired map column ("titles") contains an entry for the primary locale key ("en"), that entry is promoted to the shortcut column and removed from the map, so the value is never duplicated across both fields.
- If the paired map becomes empty after removing the primary locale entry, it is dropped from the result to avoid writing a redundant empty map.
func CollectionForKey ¶ added in v0.9.0
func CollectionForKey(def *ingitdb.Definition, id string) (*ingitdb.CollectionDef, string, error)
CollectionForKey finds the collection and record key for a given ID string.
The id format is "{collectionID}/{recordKey}" where collection IDs use "." for namespaces. "/" is reserved for separating collection ID from record key path segments. The longest matching collection prefix wins.
func ParseMapOfIDRecordsContent ¶ added in v0.12.0
func ParseMapOfIDRecordsContent(content []byte, format ingitdb.RecordFormat) (map[string]map[string]any, error)
ParseMapOfIDRecordsContent parses content containing a map of ID-keyed records.
func ParseRecordContent ¶ added in v0.12.0
ParseRecordContent parses record content in YAML or JSON format.
Types ¶
This section is empty.