definition

package
v0.1.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LocationColumns []string = []string{
	"id",
	"parent_id",
	"main_id",
	"hierarchy",
	"depth",
	"identifier_path",
	"content_type",
	"content_id",
	"language",
	"identifier_path",
	"name",
	"is_hidden",
	"is_invisible",
	"priority",
	"uid",
	"section",
	"p",
}

Functions

func GetFields

func GetFields(typePath string) (map[string]FieldDef, error)

Get fields based on path pattern including container, separated by / . eg. article/relations, report/step1

func LoadDefinition

func LoadDefinition() error

LoadDefinition Load all setting in file into memory.

Types

type ContentType

type ContentType struct {
	Name         string      `json:"name"`
	TableName    string      `json:"table_name"`
	RelationData []string    `json:"relation_data"`
	NamePattern  string      `json:"name_pattern"`
	HasVersion   bool        `json:"has_version"`
	HasLocation  bool        `json:"has_location"`
	AllowedTypes []string    `json:"allowed_types"`
	Fields       []FieldDef  `json:"fields"`
	DataFields   []DataField `json:"data_fields"`
	//All fields where identifier is the key.
	FieldMap            map[string]FieldDef `json:"-"`
	FieldIdentifierList []string            `json:"-"`
	// contains filtered or unexported fields
}

func GetDefinition

func GetDefinition(contentType string, language ...string) (ContentType, error)

Get a definition of a contenttype

func (*ContentType) HasDataField

func (c *ContentType) HasDataField(identifier string) bool

func (ContentType) HasRelationlist

func (c ContentType) HasRelationlist() bool

func (*ContentType) Init

func (c *ContentType) Init(fieldCallback ...func(*FieldDef))

type ContentTypeList

type ContentTypeList map[string]map[string]ContentType

func GetDefinitionList

func GetDefinitionList() ContentTypeList

type DataField

type DataField struct {
	Identifier string `json:"identifier"`
	FieldType  string `json:"fieldtype"`
	Name       string `json:"name"`
}

type FieldDef

type FieldDef struct {
	Identifier   string          `json:"identifier"`
	Name         string          `json:"name"`
	FieldType    string          `json:"type"`
	DefaultValue interface{}     `json:"default_value"` //eg. checkbox 1 means checked
	Required     bool            `json:"required"`
	Description  string          `json:"description"`
	IsOutput     bool            `json:"is_output"`
	Parameters   FieldParameters `json:"parameters"`
	Children     []FieldDef      `json:"children"`
}

Content field definition

func (*FieldDef) GetSubFields

func (cf *FieldDef) GetSubFields(callback ...func(*FieldDef)) map[string]FieldDef

type FieldParameters

type FieldParameters map[string]interface{}

type VaidationRule

type VaidationRule map[string]interface{}

ValidationRule defines rule for a field's validation. eg. max length

Jump to

Keyboard shortcuts

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