ingitdb

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 5 Imported by: 0

README

Package ingitdb

inGitDB schema & config types.

Schema types

  • type Definition — top-level schema definition; holds all collection definitions
    • type CollectionDef — schema for one collection
    • type ViewDef — materialized view definition (ordering, columns, format, top-N limit)

Configuration types

  • package config
    • type RootConfig — parsed from .ingitdb.yaml; maps collection keys to paths

Documentation

Index

Constants

View Source
const CollectionDefFileName = ".ingitdb-collection.yaml"

Variables

This section is empty.

Functions

func Validate

func Validate() func(*ReadOptions)

func ValidateColumnType

func ValidateColumnType(ct ColumnType) error

Types

type CollectionDef

type CollectionDef struct {
	ID           string                `json:"-"`
	Titles       map[string]string     `yaml:"titles,omitempty"`
	RecordFile   *RecordFileDef        `yaml:"record_file"`
	DataDir      string                `yaml:"data_dir,omitempty"`
	Columns      map[string]*ColumnDef `yaml:"columns"`
	ColumnsOrder []string              `yaml:"columns_order,omitempty"`
	DefaultView  string                `yaml:"default_view,omitempty"`
}

func (*CollectionDef) Validate

func (v *CollectionDef) Validate() error

type ColumnDef

type ColumnDef struct {
	Type       ColumnType        `yaml:"type"`
	Title      string            `yaml:"title,omitempty"`
	Titles     map[string]string `yaml:"titles,omitempty"`
	ValueTitle string            `yaml:"valueTitle,omitempty"`
	Required   bool              `yaml:"required,omitempty"`
	Length     int               `yaml:"length,omitempty"`
	MinLength  int               `yaml:"min_length,omitempty"`
	MaxLength  int               `yaml:"max_length,omitempty"`
	ForeignKey string            `yaml:"foreign_key,omitempty"`
}

func (*ColumnDef) Validate

func (v *ColumnDef) Validate() error

type ColumnDefWithID

type ColumnDefWithID struct {
	ID string `yaml:"id"`
	ColumnDef
}

type ColumnType

type ColumnType string
const (
	ColumnTypeL10N     ColumnType = "map[locale]string"
	ColumnTypeString   ColumnType = "string"
	ColumnTypeInt      ColumnType = "int"
	ColumnTypeFloat    ColumnType = "float"
	ColumnTypeBool     ColumnType = "bool"
	ColumnTypeDate     ColumnType = "date"
	ColumnTypeTime     ColumnType = "time"
	ColumnTypeDateTime ColumnType = "datetime"
	ColumnTypeAny      ColumnType = "any"
)

type Definition

type Definition struct {
	Collections map[string]*CollectionDef `yaml:"collections,omitempty"`
}

type ReadOption

type ReadOption func(*ReadOptions)

type ReadOptions

type ReadOptions struct {
	// contains filtered or unexported fields
}

func NewReadOptions

func NewReadOptions(o ...ReadOption) (opts ReadOptions)

func (*ReadOptions) IsValidationRequired

func (o *ReadOptions) IsValidationRequired() bool

type RecordFileDef

type RecordFileDef struct {
	Name   string       `yaml:"name"`
	Format RecordFormat `yaml:"format"`

	// RecordType can have next values:
	// "map[string]any" - each record in a separate file
	// "[]map[string]any" - list of records
	// "map[string]map[string]any" - dictionary of records
	RecordType RecordType `yaml:"type"`
}

func (RecordFileDef) GetRecordFileName

func (rfd RecordFileDef) GetRecordFileName(record dal.Record) string

func (RecordFileDef) Validate

func (rfd RecordFileDef) Validate() error

type RecordFormat

type RecordFormat string

type RecordType

type RecordType string
const (
	SingleRecord  RecordType = "map[string]any"
	ListOfRecords RecordType = "[]map[string]any"
	MapOfRecords  RecordType = "map[string]map[string]any"
)

type ViewDef

type ViewDef struct {
	ID      string            `yaml:"-"`
	Titles  map[string]string `yaml:"titles,omitempty"`
	OrderBy string            `yaml:"order_by,omitempty"`
	Formats []string          `yaml:"formats,omitempty"`
	Columns []string          `yaml:"columns,omitempty"`
	// How many records to include; 0 means all
	Top int `yaml:"top,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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