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"`
}
type ColumnDefWithID ¶
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"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.