property

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPropertyValue = errors.New("invalid property value")
	ErrCannotLinkDataset    = errors.New("cannot link dataset")
	ErrInvalidPropertyType  = errors.New("invalid property type")
	ErrInvalidPropertyField = errors.New("invalid property field")
)
View Source
var (
	ErrInvalidSceneID               = errors.New("invalid scene id")
	ErrInvalidPropertySchemaID      = errors.New("invalid property schema id")
	ErrInvalidValue                 = errors.New("invalid value")
	ErrInvalidPropertyLinkableField = errors.New("invalid property linkable field")
	ErrInvalidVersion               = errors.New("invalid version")
)
View Source
var (
	ValueTypeUnknown      = ValueType(value.TypeUnknown)
	ValueTypeBool         = ValueType(value.TypeBool)
	ValueTypeNumber       = ValueType(value.TypeNumber)
	ValueTypeString       = ValueType(value.TypeString)
	ValueTypeRef          = ValueType(value.TypeRef)
	ValueTypeURL          = ValueType(value.TypeURL)
	ValueTypeLatLng       = ValueType(value.TypeLatLng)
	ValueTypeLatLngHeight = ValueType(value.TypeLatLngHeight)
	ValueTypeCoordinates  = ValueType(value.TypeCoordinates)
	ValueTypePolygon      = ValueType(value.TypePolygon)
	ValueTypeRect         = ValueType(value.TypeRect)
)
View Source
var DatasetFieldIDFrom = id.DatasetFieldIDFrom
View Source
var DatasetFieldIDFromRef = id.DatasetFieldIDFromRef
View Source
var DatasetIDFrom = id.DatasetIDFrom
View Source
var DatasetIDFromRef = id.DatasetIDFromRef
View Source
var DatasetSchemaIDFrom = id.DatasetSchemaIDFrom
View Source
var DatasetSchemaIDFromRef = id.DatasetSchemaIDFromRef
View Source
var ErrInvalidGroupInGroupList = errors.New("cannot contain an invalid property group in the property group list")
View Source
var ErrInvalidID = id.ErrInvalidID
View Source
var ErrSchemaDoesNotMatch = errors.New("schema of the initializer does not match schema of the argument")
View Source
var IDFromRef = id.PropertyIDFromRef
View Source
var ItemIDFrom = id.PropertyItemIDFrom
View Source
var ItemIDFromRef = id.PropertyItemIDFromRef
View Source
var MustDatasetFieldID = id.MustDatasetFieldID
View Source
var MustDatasetID = id.MustDatasetID
View Source
var MustDatasetSchemaID = id.MustDatasetSchemaID
View Source
var MustItemID = id.MustPropertyItemID
View Source
var MustSceneID = id.MustSceneID
View Source
var MustSchemaID = id.MustPropertySchemaID
View Source
var NewDatasetFieldID = id.NewDatasetFieldID
View Source
var NewDatasetID = id.NewDatasetID
View Source
var NewDatasetSchemaID = id.NewDatasetSchemaID
View Source
var NewItemID = id.NewPropertyItemID
View Source
var NewItemIDSet = id.NewPropertyItemIDSet
View Source
var NewSceneID = id.NewSceneID
View Source
var NewSchemaID = id.NewPropertySchemaID
View Source
var SceneIDFrom = id.SceneIDFrom
View Source
var SceneIDFromRef = id.SceneIDFromRef
View Source
var SchemaIDFrom = id.PropertySchemaIDFrom
View Source
var SchemaIDFromRef = id.PropertySchemaIDFromRef
View Source
var ValueTypeCamera = ValueType("camera")
View Source
var ValueTypeTypography = ValueType("typography")

Functions

This section is empty.

Types

type Builder

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

func New

func New() *Builder

func (*Builder) Build

func (b *Builder) Build() (*Property, error)

func (*Builder) ID

func (b *Builder) ID(id ID) *Builder

func (*Builder) Items

func (b *Builder) Items(items []Item) *Builder

func (*Builder) MustBuild

func (b *Builder) MustBuild() *Property

func (*Builder) NewID

func (b *Builder) NewID() *Builder

func (*Builder) Scene

func (b *Builder) Scene(s SceneID) *Builder

func (*Builder) Schema

func (b *Builder) Schema(schema SchemaID) *Builder

type Camera

type Camera struct {
	Lat      float64 `json:"lat" mapstructure:"lat"`
	Lng      float64 `json:"lng" mapstructure:"lng"`
	Altitude float64 `json:"altitude" mapstructure:"altitude"`
	Heading  float64 `json:"heading" mapstructure:"heading"`
	Pitch    float64 `json:"pitch" mapstructure:"pitch"`
	Roll     float64 `json:"roll" mapstructure:"roll"`
	FOV      float64 `json:"fov" mapstructure:"fov"`
}

func (*Camera) Clone

func (c *Camera) Clone() *Camera

type Condition

type Condition struct {
	Field FieldID
	Value *Value
}

func (*Condition) Clone

func (c *Condition) Clone() *Condition

type Coordinates

type Coordinates = value.Coordinates

type DatasetFieldID added in v0.4.0

type DatasetFieldID = id.DatasetFieldID

type DatasetID added in v0.4.0

type DatasetID = id.DatasetID

type DatasetMigrationParam

type DatasetMigrationParam struct {
	OldDatasetSchemaMap map[DatasetSchemaID]DatasetSchemaID
	OldDatasetMap       map[DatasetID]DatasetID
	DatasetFieldIDMap   map[DatasetFieldID]DatasetFieldID
	NewDatasetSchemaMap map[DatasetSchemaID]*dataset.Schema
	NewDatasetMap       map[DatasetID]*dataset.Dataset
}

type DatasetSchemaID added in v0.4.0

type DatasetSchemaID = id.DatasetSchemaID

type Field

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

func (*Field) ActualValue

func (p *Field) ActualValue(ds *dataset.Dataset) *ValueAndDatasetValue

func (*Field) Cast added in v0.4.0

func (p *Field) Cast(t ValueType) bool

func (*Field) Clone

func (p *Field) Clone() *Field

func (*Field) Datasets added in v0.4.0

func (p *Field) Datasets() []DatasetID

func (*Field) Field

func (p *Field) Field() FieldID

func (*Field) FieldRef added in v0.5.0

func (p *Field) FieldRef() *FieldID

func (*Field) GuessSchema added in v0.5.0

func (f *Field) GuessSchema() *SchemaField

func (*Field) IsDatasetLinked

func (p *Field) IsDatasetLinked(s DatasetSchemaID, i DatasetID) bool

func (*Field) IsEmpty

func (p *Field) IsEmpty() bool
func (p *Field) Link(links *Links)
func (p *Field) Links() *Links

func (*Field) MigrateDataset

func (p *Field) MigrateDataset(q DatasetMigrationParam)

func (*Field) MigrateSchema

func (p *Field) MigrateSchema(ctx context.Context, newSchema *Schema, dl dataset.Loader) bool

func (*Field) Type

func (p *Field) Type() ValueType

func (*Field) TypeAndValue added in v0.5.0

func (p *Field) TypeAndValue() *OptionalValue
func (p *Field) Unlink()

func (*Field) Update

func (p *Field) Update(value *Value, field *SchemaField) error

func (*Field) UpdateField

func (p *Field) UpdateField(field FieldID)

func (*Field) UpdateUnsafe

func (p *Field) UpdateUnsafe(value *Value)

func (*Field) Value

func (p *Field) Value() *Value

type FieldBuilder

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

func FieldFrom added in v0.4.0

func FieldFrom(sf *SchemaField) *FieldBuilder

func NewField

func NewField(field FieldID) *FieldBuilder

func (*FieldBuilder) Build

func (b *FieldBuilder) Build() *Field

func (*FieldBuilder) Field added in v0.4.0

func (b *FieldBuilder) Field(field FieldID) *FieldBuilder
func (b *FieldBuilder) Links(l *Links) *FieldBuilder

func (*FieldBuilder) MustBuild

func (b *FieldBuilder) MustBuild() *Field

func (*FieldBuilder) Type added in v0.4.0

func (b *FieldBuilder) Type(t ValueType) *FieldBuilder

func (*FieldBuilder) Value

func (b *FieldBuilder) Value(v *OptionalValue) *FieldBuilder

type FieldID added in v0.4.0

type FieldID = id.PropertyFieldID

type Group

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

Group represents a group of property

func InitGroupFrom

func InitGroupFrom(g *SchemaGroup) *Group

func ToGroup

func ToGroup(i Item) *Group

func (*Group) AddFields added in v0.5.0

func (g *Group) AddFields(fields ...*Field)

func (*Group) Clone added in v0.5.0

func (p *Group) Clone() *Group

func (*Group) CloneItem added in v0.5.0

func (p *Group) CloneItem() Item

func (*Group) Datasets added in v0.4.0

func (g *Group) Datasets() []DatasetID

func (*Group) Field

func (g *Group) Field(fid FieldID) *Field

Field returns a field whose id is specified

func (*Group) FieldIDs

func (g *Group) FieldIDs() []FieldID

func (*Group) Fields

func (g *Group) Fields(p *Pointer) []*Field

func (*Group) FieldsByLinkedDataset

func (g *Group) FieldsByLinkedDataset(s DatasetSchemaID, i DatasetID) []*Field

func (*Group) GetOrCreateField

func (g *Group) GetOrCreateField(ps *Schema, fid FieldID) (*Field, bool)

func (*Group) GroupAndFields added in v0.5.0

func (p *Group) GroupAndFields(ptr *Pointer) []GroupAndField

func (*Group) GuessSchema added in v0.5.0

func (g *Group) GuessSchema() *SchemaGroup

func (*Group) HasLinkedField

func (g *Group) HasLinkedField() bool

func (*Group) ID

func (g *Group) ID() ItemID

func (*Group) IDRef

func (g *Group) IDRef() *ItemID

func (*Group) IsDatasetLinked

func (g *Group) IsDatasetLinked(s DatasetSchemaID, i DatasetID) bool

func (*Group) IsEmpty

func (g *Group) IsEmpty() bool

func (*Group) MigrateDataset

func (g *Group) MigrateDataset(q DatasetMigrationParam)

func (*Group) MigrateSchema

func (g *Group) MigrateSchema(ctx context.Context, newSchema *Schema, dl dataset.Loader)

TODO: group migration

func (*Group) Prune

func (g *Group) Prune() (res bool)

func (*Group) RemoveField

func (g *Group) RemoveField(fid FieldID) (res bool)

func (*Group) RemoveFields added in v0.5.0

func (g *Group) RemoveFields(ptr *Pointer) (res bool)

func (*Group) RepresentativeField added in v0.4.0

func (g *Group) RepresentativeField(schema *Schema) *Field

func (*Group) SchemaGroup

func (g *Group) SchemaGroup() SchemaGroupID

func (*Group) SchemaGroupRef

func (g *Group) SchemaGroupRef() *SchemaGroupID

func (*Group) ValidateSchema

func (p *Group) ValidateSchema(ps *SchemaGroup) error

type GroupAndField added in v0.5.0

type GroupAndField struct {
	ParentGroup *GroupList
	Group       *Group
	Field       *Field
}

func (GroupAndField) SchemaFieldPointer added in v0.5.0

func (f GroupAndField) SchemaFieldPointer() SchemaFieldPointer

type GroupBuilder

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

func NewGroup

func NewGroup() *GroupBuilder

func (*GroupBuilder) Build

func (b *GroupBuilder) Build() (*Group, error)

func (*GroupBuilder) Fields

func (b *GroupBuilder) Fields(fields []*Field) *GroupBuilder

func (*GroupBuilder) ID

func (b *GroupBuilder) ID(id ItemID) *GroupBuilder

func (*GroupBuilder) MustBuild

func (b *GroupBuilder) MustBuild() *Group

func (*GroupBuilder) NewID

func (b *GroupBuilder) NewID() *GroupBuilder

func (*GroupBuilder) SchemaGroup added in v0.4.0

func (b *GroupBuilder) SchemaGroup(g SchemaGroupID) *GroupBuilder

type GroupList

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

func InitGroupListFrom

func InitGroupListFrom(g *SchemaGroup) *GroupList

func ToGroupList

func ToGroupList(i Item) *GroupList

func (*GroupList) Add

func (g *GroupList) Add(gg *Group, index int)

func (*GroupList) AddOrMove

func (g *GroupList) AddOrMove(gg *Group, index int)

func (*GroupList) Clone added in v0.5.0

func (p *GroupList) Clone() *GroupList

func (*GroupList) CloneItem added in v0.5.0

func (p *GroupList) CloneItem() Item

func (*GroupList) Count

func (g *GroupList) Count() int

func (*GroupList) CreateAndAddListItem

func (g *GroupList) CreateAndAddListItem(ps *Schema, index *int) *Group

func (*GroupList) Datasets added in v0.4.0

func (g *GroupList) Datasets() []DatasetID

func (*GroupList) Empty

func (g *GroupList) Empty()

func (*GroupList) Fields added in v0.5.0

func (g *GroupList) Fields(ptr *Pointer) []*Field

func (*GroupList) FieldsByLinkedDataset

func (g *GroupList) FieldsByLinkedDataset(s DatasetSchemaID, i DatasetID) []*Field

func (*GroupList) GetOrCreateField

func (g *GroupList) GetOrCreateField(ps *Schema, ptr *Pointer) (*Field, bool)

func (*GroupList) Group added in v0.4.0

func (g *GroupList) Group(gid ItemID) *Group

Group returns a group whose id is specified

func (*GroupList) GroupAndFields added in v0.5.0

func (p *GroupList) GroupAndFields(ptr *Pointer) []GroupAndField

func (*GroupList) GroupAt

func (g *GroupList) GroupAt(i int) *Group

GroupAt returns a group whose index is specified

func (*GroupList) GroupByPointer added in v0.5.0

func (g *GroupList) GroupByPointer(ptr *Pointer) *Group

func (*GroupList) Groups

func (g *GroupList) Groups() []*Group

Groups returns a slice of groups

func (*GroupList) GuessSchema added in v0.5.0

func (g *GroupList) GuessSchema() *SchemaGroup

func (*GroupList) Has

func (g *GroupList) Has(i ItemID) bool

func (*GroupList) HasLinkedField

func (g *GroupList) HasLinkedField() bool

func (*GroupList) ID

func (g *GroupList) ID() ItemID

ID returns id

func (*GroupList) IDRef

func (g *GroupList) IDRef() *ItemID

IDRef returns a reference of id

func (*GroupList) IsDatasetLinked

func (g *GroupList) IsDatasetLinked(s DatasetSchemaID, i DatasetID) bool

func (*GroupList) IsEmpty

func (g *GroupList) IsEmpty() bool

func (*GroupList) MigrateDataset

func (g *GroupList) MigrateDataset(q DatasetMigrationParam)

func (*GroupList) MigrateSchema

func (g *GroupList) MigrateSchema(ctx context.Context, newSchema *Schema, dl dataset.Loader)

func (*GroupList) Move

func (g *GroupList) Move(id ItemID, toIndex int)

func (*GroupList) MoveAt

func (g *GroupList) MoveAt(fromIndex int, toIndex int)

func (*GroupList) Prune

func (g *GroupList) Prune() (res bool)

func (*GroupList) Remove

func (g *GroupList) Remove(id ItemID) bool

func (*GroupList) RemoveAt

func (g *GroupList) RemoveAt(index int)

func (*GroupList) RemoveFields added in v0.5.0

func (g *GroupList) RemoveFields(ptr *Pointer) (res bool)

func (*GroupList) SchemaGroup

func (g *GroupList) SchemaGroup() SchemaGroupID

SchemaGroup returns id of schema group

func (*GroupList) SchemaGroupRef

func (g *GroupList) SchemaGroupRef() *SchemaGroupID

func (*GroupList) ValidateSchema

func (p *GroupList) ValidateSchema(ps *SchemaGroup) error

type GroupListBuilder

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

func NewGroupList

func NewGroupList() *GroupListBuilder

func (*GroupListBuilder) Build

func (b *GroupListBuilder) Build() (*GroupList, error)

func (*GroupListBuilder) Groups

func (b *GroupListBuilder) Groups(groups []*Group) *GroupListBuilder

func (*GroupListBuilder) ID

func (*GroupListBuilder) MustBuild

func (b *GroupListBuilder) MustBuild() *GroupList

func (*GroupListBuilder) NewID

func (b *GroupListBuilder) NewID() *GroupListBuilder

func (*GroupListBuilder) SchemaGroup added in v0.4.0

func (b *GroupListBuilder) SchemaGroup(g SchemaGroupID) *GroupListBuilder

type ID added in v0.4.0

type ID = id.PropertyID

type IDList added in v0.6.1

type IDList = id.PropertyIDList

type IDSet added in v0.4.0

type IDSet = id.PropertyIDSet

type Initializer

type Initializer struct {
	ID     *ID                `json:"id"`
	Schema SchemaID           `json:"schema"`
	Items  []*InitializerItem `json:"items"`
}

func (*Initializer) Clone

func (p *Initializer) Clone() *Initializer

func (*Initializer) MustBeProperty

func (p *Initializer) MustBeProperty(scene SceneID) *Property

func (*Initializer) Property

func (p *Initializer) Property(scene SceneID) (*Property, error)

func (*Initializer) PropertyIncludingEmpty

func (p *Initializer) PropertyIncludingEmpty(scene SceneID, schema SchemaID) (*Property, error)

PropertyIncludingEmpty generates a new property, but even if the initializer is empty, an empty property will be generated.

type InitializerField

type InitializerField struct {
	Field FieldID            `json:"field"`
	Type  ValueType          `json:"type"`
	Value *Value             `json:"value"`
	Links []*InitializerLink `json:"links"`
}

func (*InitializerField) Clone

func (p *InitializerField) Clone() *InitializerField

func (*InitializerField) PropertyField

func (p *InitializerField) PropertyField() *Field

type InitializerGroup

type InitializerGroup struct {
	ID     *ItemID             `json:"id"`
	Fields []*InitializerField `json:"fields"`
}

func (*InitializerGroup) Clone

func (p *InitializerGroup) Clone() *InitializerGroup

func (*InitializerGroup) PropertyGroup

func (p *InitializerGroup) PropertyGroup(parentItem SchemaGroupID) (*Group, error)

type InitializerItem

type InitializerItem struct {
	ID         *ItemID             `json:"id"`
	SchemaItem SchemaGroupID       `json:"schemaItem"`
	Groups     []*InitializerGroup `json:"groups"`
	Fields     []*InitializerField `json:"fields"`
}

func (*InitializerItem) Clone

func (p *InitializerItem) Clone() *InitializerItem

func (*InitializerItem) PropertyGroup

func (p *InitializerItem) PropertyGroup() *Group

func (*InitializerItem) PropertyGroupList

func (p *InitializerItem) PropertyGroupList() *GroupList

func (*InitializerItem) PropertyItem

func (p *InitializerItem) PropertyItem() (Item, error)
type InitializerLink struct {
	Dataset *DatasetID      `json:"dataset"`
	Schema  DatasetSchemaID `json:"schema"`
	Field   DatasetFieldID  `json:"field"`
}

func (*InitializerLink) Clone

func (p *InitializerLink) Clone() *InitializerLink
func (p *InitializerLink) PropertyLink() *Link

type Item

type Item interface {
	ID() ItemID
	IDRef() *ItemID
	SchemaGroup() SchemaGroupID
	SchemaGroupRef() *SchemaGroupID
	HasLinkedField() bool
	Datasets() []DatasetID
	FieldsByLinkedDataset(DatasetSchemaID, DatasetID) []*Field
	IsDatasetLinked(DatasetSchemaID, DatasetID) bool
	IsEmpty() bool
	Prune() bool
	MigrateSchema(context.Context, *Schema, dataset.Loader)
	MigrateDataset(DatasetMigrationParam)
	ValidateSchema(*SchemaGroup) error
	Fields(*Pointer) []*Field
	RemoveFields(*Pointer) bool
	CloneItem() Item
	GroupAndFields(*Pointer) []GroupAndField
	GuessSchema() *SchemaGroup
}

func InitItemFrom

func InitItemFrom(psg *SchemaGroup) Item

type ItemBuilder

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

func NewItem

func NewItem() *ItemBuilder

func (*ItemBuilder) Group

func (b *ItemBuilder) Group() *GroupBuilder

func (*ItemBuilder) GroupList

func (b *ItemBuilder) GroupList() *GroupListBuilder

func (*ItemBuilder) ID

func (b *ItemBuilder) ID(id ItemID) *ItemBuilder

func (*ItemBuilder) NewID

func (b *ItemBuilder) NewID() *ItemBuilder

func (*ItemBuilder) SchemaGroup added in v0.4.0

func (b *ItemBuilder) SchemaGroup(g SchemaGroupID) *ItemBuilder

type ItemID added in v0.4.0

type ItemID = id.PropertyItemID

type ItemIDSet added in v0.4.0

type ItemIDSet = id.PropertyItemIDSet

type LatLng

type LatLng = value.LatLng

type LatLngHeight

type LatLngHeight = value.LatLngHeight
type Link struct {
	// contains filtered or unexported fields
}
func NewLink(d DatasetID, ds DatasetSchemaID, f DatasetFieldID) *Link

func NewLinkFieldOnly

func NewLinkFieldOnly(ds DatasetSchemaID, f DatasetFieldID) *Link

func (*Link) ApplyDataset

func (l *Link) ApplyDataset(ds *DatasetID) *Link

func (*Link) Clone

func (l *Link) Clone() *Link

func (*Link) Dataset

func (l *Link) Dataset() *DatasetID

func (*Link) DatasetSchema

func (l *Link) DatasetSchema() *DatasetSchemaID

func (*Link) DatasetSchemaField

func (l *Link) DatasetSchemaField() *DatasetFieldID

func (*Link) Validate

func (l *Link) Validate(dss *dataset.Schema, ds *dataset.Dataset) bool

func (*Link) Value

func (l *Link) Value(ds *dataset.Dataset) *dataset.Value

type LinkableFields

type LinkableFields struct {
	LatLng *SchemaFieldPointer
	URL    *SchemaFieldPointer
}

func (LinkableFields) Clone

func (p LinkableFields) Clone() LinkableFields

func (LinkableFields) FieldByType added in v0.5.0

func (l LinkableFields) FieldByType(ty ValueType) *FieldID

func (LinkableFields) PointerByType added in v0.5.0

func (l LinkableFields) PointerByType(ty ValueType) *SchemaFieldPointer

func (LinkableFields) Validate

func (l LinkableFields) Validate(s *Schema) bool
type Links struct {
	// contains filtered or unexported fields
}
func NewLinks(links []*Link) *Links

func (*Links) ApplyDataset

func (l *Links) ApplyDataset(ds *DatasetID) *Links

func (*Links) Clone

func (l *Links) Clone() *Links

func (*Links) DatasetIDs

func (l *Links) DatasetIDs() []DatasetID

func (*Links) DatasetSchemaFieldIDs

func (l *Links) DatasetSchemaFieldIDs() []DatasetFieldID

func (*Links) DatasetSchemaIDs

func (l *Links) DatasetSchemaIDs() []DatasetSchemaID

func (*Links) DatasetValue

func (l *Links) DatasetValue(ctx context.Context, d dataset.GraphLoader) (*dataset.Value, error)

func (*Links) First

func (l *Links) First() *Link

func (*Links) HasDataset

func (l *Links) HasDataset(did DatasetID) bool

func (*Links) HasDatasetSchema

func (l *Links) HasDatasetSchema(dsid DatasetSchemaID) bool

func (*Links) HasDatasetSchemaAndDataset added in v0.4.0

func (l *Links) HasDatasetSchemaAndDataset(dsid DatasetSchemaID, did DatasetID) bool

func (*Links) HasSchemaAndDataset added in v0.4.0

func (l *Links) HasSchemaAndDataset(s DatasetSchemaID, dsid DatasetID) bool

func (*Links) IsEmpty

func (l *Links) IsEmpty() bool

func (*Links) IsLinked

func (l *Links) IsLinked() bool

func (*Links) IsLinkedFully

func (l *Links) IsLinkedFully() bool

func (*Links) Last

func (l *Links) Last() *Link

func (*Links) LastValue

func (l *Links) LastValue(ds *dataset.Dataset) *dataset.Value

func (*Links) Len

func (l *Links) Len() int
func (l *Links) Links() []*Link

func (*Links) Replace

func (l *Links) Replace(
	dsm map[DatasetSchemaID]DatasetSchemaID,
	dm map[DatasetID]DatasetID,
	fm map[DatasetFieldID]DatasetFieldID,
)

func (*Links) Validate

func (l *Links) Validate(dsm dataset.SchemaMap, dm dataset.Map) bool

type List

type List []*Property

func (List) IDs added in v0.4.0

func (l List) IDs() []ID

func (List) Map

func (l List) Map() Map

func (List) Schemas

func (l List) Schemas() []SchemaID

func (List) Sort added in v0.6.1

func (l List) Sort()

type Loader

type Loader func(context.Context, ...ID) (List, error)

func LoaderFrom

func LoaderFrom(data []*Property) Loader

func LoaderFromMap

func LoaderFromMap(data map[ID]*Property) Loader

type Map

type Map map[ID]*Property

func MapFrom

func MapFrom(properties ...*Property) Map

func (Map) Add

func (m Map) Add(properties ...*Property) Map

func (Map) Clone

func (m Map) Clone() Map

func (Map) Keys

func (m Map) Keys() []ID

func (Map) Len

func (m Map) Len() int

func (Map) List

func (m Map) List() List

func (Map) Merge

func (m Map) Merge(m2 Map) Map

type Merged

type Merged struct {
	Original      *ID
	Parent        *ID
	Schema        SchemaID
	LinkedDataset *DatasetID
	Groups        []*MergedGroup
}

Merged represents a merged property from two properties

func Merge

func Merge(o *Property, p *Property, linked *DatasetID) *Merged

Merge merges two properties

func (*Merged) Datasets

func (m *Merged) Datasets() []DatasetID

Datasets returns associated dataset IDs

type MergedField

type MergedField struct {
	ID         FieldID
	Type       ValueType
	Value      *Value
	Links      *Links
	Overridden bool
}

MergedField represents a field of Merged

func (*MergedField) DatasetValue

func (f *MergedField) DatasetValue(ctx context.Context, d dataset.GraphLoader) (*dataset.Value, error)

type MergedGroup

type MergedGroup struct {
	Original      *ItemID
	Parent        *ItemID
	SchemaGroup   SchemaGroupID
	LinkedDataset *DatasetID
	Groups        []*MergedGroup
	Fields        []*MergedField
}

MergedGroup represents a group of Merged

func (*MergedGroup) Datasets

func (m *MergedGroup) Datasets() []DatasetID

Datasets returns associated dataset IDs

type MergedMetadata

type MergedMetadata struct {
	Original      *ID
	Parent        *ID
	LinkedDataset *DatasetID
}

func MergedMetadataFrom

func MergedMetadataFrom(p ID) MergedMetadata

MergedMetadataFrom generates MergedMetadata from single property

func (MergedMetadata) Merge

func (m MergedMetadata) Merge(o *Property, p *Property) *Merged

Merge merges two properties

func (MergedMetadata) Properties

func (m MergedMetadata) Properties() []ID

Properties returns associated property IDs

type MigrationPlan added in v0.2.0

type MigrationPlan struct {
	From *Pointer
	To   *Pointer
}

type Migrator added in v0.2.0

type Migrator struct {
	NewSchema *Schema
	Plans     []MigrationPlan
}

type OptionalValue added in v0.3.0

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

func NewOptionalValue added in v0.3.0

func NewOptionalValue(t ValueType, v *Value) *OptionalValue

func OptionalValueFrom added in v0.3.0

func OptionalValueFrom(v *Value) *OptionalValue

func (*OptionalValue) Cast added in v0.3.0

func (ov *OptionalValue) Cast(t ValueType) *OptionalValue

func (*OptionalValue) Clone added in v0.3.0

func (ov *OptionalValue) Clone() *OptionalValue

func (*OptionalValue) SetValue added in v0.3.0

func (ov *OptionalValue) SetValue(v *Value)

func (*OptionalValue) Type added in v0.3.0

func (ov *OptionalValue) Type() ValueType

func (*OptionalValue) TypeAndValue added in v0.3.0

func (ov *OptionalValue) TypeAndValue() (ValueType, *Value)

func (*OptionalValue) Value added in v0.3.0

func (ov *OptionalValue) Value() *Value

type Pointer

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

Pointer is a pointer to a field and an item in properties and schemas

func NewPointer

func NewPointer(sg *SchemaGroupID, i *ItemID, f *FieldID) *Pointer

NewPointer creates a new Pointer.

func PointField

func PointField(sg *SchemaGroupID, i *ItemID, f FieldID) *Pointer

PointField creates a new Pointer pointing the field in properties.

func PointFieldByItem

func PointFieldByItem(i ItemID, f FieldID) *Pointer

PointFieldByItem creates a new Pointer pointing to the field of the item in properties.

func PointFieldBySchemaGroup

func PointFieldBySchemaGroup(sg SchemaGroupID, f FieldID) *Pointer

PointFieldBySchemaGroup creates a new Pointer pointing to the field of the schema field in properties.

func PointFieldOnly

func PointFieldOnly(fid FieldID) *Pointer

PointField creates a new Pointer pointing the field in property schemas.

func PointItem

func PointItem(i ItemID) *Pointer

PointItem creates a new Pointer pointing to the item in properties.

func PointItemBySchema

func PointItemBySchema(sg SchemaGroupID) *Pointer

PointItemBySchema creates a new Pointer pointing the schema item in property schemas.

func PointToEverything added in v0.5.0

func PointToEverything() *Pointer

PointToEverything creates a new Pointer pointing to all items and fields.

func (*Pointer) AllFields added in v0.5.0

func (p *Pointer) AllFields() *Pointer

func (*Pointer) Clone

func (p *Pointer) Clone() *Pointer

func (*Pointer) Field

func (p *Pointer) Field() (f FieldID, ok bool)

func (*Pointer) FieldByItem

func (p *Pointer) FieldByItem() (i ItemID, f FieldID, ok bool)

func (*Pointer) FieldBySchemaGroup

func (p *Pointer) FieldBySchemaGroup() (sg SchemaGroupID, f FieldID, ok bool)

func (*Pointer) FieldIfItemIs added in v0.5.0

func (p *Pointer) FieldIfItemIs(sg SchemaGroupID, i ItemID) (f FieldID, ok bool)

func (*Pointer) FieldIfItemIsRef added in v0.5.0

func (p *Pointer) FieldIfItemIsRef(sg SchemaGroupID, i ItemID) *FieldID

func (*Pointer) FieldOnly added in v0.5.0

func (p *Pointer) FieldOnly() (f FieldID, ok bool)

func (*Pointer) FieldOnlyRef added in v0.5.0

func (p *Pointer) FieldOnlyRef() *FieldID

func (*Pointer) FieldRef

func (p *Pointer) FieldRef() *FieldID

func (*Pointer) GetAll

func (p *Pointer) GetAll() (sg *SchemaGroupID, i *ItemID, f *FieldID)

func (*Pointer) Item

func (p *Pointer) Item() (i ItemID, ok bool)

func (*Pointer) ItemBySchemaGroup

func (p *Pointer) ItemBySchemaGroup() (i SchemaGroupID, ok bool)

func (*Pointer) ItemBySchemaGroupAndItem

func (p *Pointer) ItemBySchemaGroupAndItem() (i SchemaGroupID, i2 ItemID, ok bool)

func (*Pointer) ItemRef

func (p *Pointer) ItemRef() *ItemID

func (*Pointer) SchemaGroupAndItem

func (p *Pointer) SchemaGroupAndItem() (i SchemaGroupID, i2 ItemID, ok bool)

func (*Pointer) Test added in v0.5.0

func (p *Pointer) Test(sg SchemaGroupID, i ItemID, f FieldID) bool

func (*Pointer) TestField added in v0.5.0

func (p *Pointer) TestField(f FieldID) bool

func (*Pointer) TestItem added in v0.5.0

func (p *Pointer) TestItem(sg SchemaGroupID, i ItemID) bool

func (*Pointer) TestSchemaGroup added in v0.5.0

func (p *Pointer) TestSchemaGroup(sg SchemaGroupID) bool

type Polygon

type Polygon = value.Polygon

type Property

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

func (*Property) AddItem added in v0.5.0

func (p *Property) AddItem(i Item) bool

func (*Property) AddListItem

func (p *Property) AddListItem(ps *Schema, ptr *Pointer, index *int) (*Group, *GroupList)

func (*Property) AutoLinkField

func (p *Property) AutoLinkField(s *Schema, v ValueType, d DatasetSchemaID, df *DatasetFieldID, ds *DatasetID)

func (*Property) Cast added in v0.5.0

func (p *Property) Cast(ptr *Pointer, t ValueType) (res bool)

Cast changes the type of fields that are matches the pointer

func (*Property) Clone added in v0.5.0

func (p *Property) Clone() *Property

func (*Property) Datasets added in v0.4.0

func (p *Property) Datasets() []DatasetID

func (*Property) Field

func (p *Property) Field(ptr *Pointer) (*Field, *GroupList, *Group)

func (*Property) Fields added in v0.5.0

func (p *Property) Fields(ptr *Pointer) []*Field

func (*Property) FieldsByLinkedDataset

func (p *Property) FieldsByLinkedDataset(s DatasetSchemaID, i DatasetID) []*Field

func (*Property) GetOrCreateField

func (p *Property) GetOrCreateField(ps *Schema, ptr *Pointer) (*Field, *GroupList, *Group, bool)

func (*Property) GetOrCreateGroup

func (p *Property) GetOrCreateGroup(ps *Schema, ptr *Pointer) (*Group, *GroupList)

func (*Property) GetOrCreateGroupList

func (p *Property) GetOrCreateGroupList(ps *Schema, ptr *Pointer) *GroupList

func (*Property) GetOrCreateItem

func (p *Property) GetOrCreateItem(ps *Schema, ptr *Pointer) (Item, *GroupList)

func (*Property) GetOrCreateRootGroup added in v0.5.0

func (p *Property) GetOrCreateRootGroup(ptr *Pointer) (*Group, bool)

func (*Property) GroupAndFields added in v0.5.0

func (p *Property) GroupAndFields(ptr *Pointer) []GroupAndField

func (*Property) GroupAndList added in v0.5.0

func (p *Property) GroupAndList(ptr *Pointer) (*Group, *GroupList)

func (*Property) GroupBySchema

func (p *Property) GroupBySchema(id SchemaGroupID) *Group

func (*Property) GroupListBySchema

func (p *Property) GroupListBySchema(id SchemaGroupID) *GroupList

func (*Property) GuessSchema added in v0.5.0

func (p *Property) GuessSchema() *Schema

func (*Property) HasLinkedField

func (p *Property) HasLinkedField() bool

func (*Property) ID

func (p *Property) ID() ID

func (*Property) IDRef

func (p *Property) IDRef() *ID

func (*Property) IsDatasetLinked

func (p *Property) IsDatasetLinked(s DatasetSchemaID, i DatasetID) bool

func (*Property) Item

func (p *Property) Item(ptr *Pointer) Item

func (*Property) ItemBySchema

func (p *Property) ItemBySchema(id SchemaGroupID) Item

ItemBySchema returns a root item by a schema group ID.

func (*Property) Items

func (p *Property) Items() []Item

func (*Property) ListItem

func (p *Property) ListItem(ptr *Pointer) (*Group, *GroupList)

func (*Property) MigrateDataset

func (p *Property) MigrateDataset(q DatasetMigrationParam)

func (*Property) MigrateSchema

func (p *Property) MigrateSchema(ctx context.Context, newSchema *Schema, dl dataset.Loader)

TODO: group migration

func (*Property) MoveFields added in v0.5.0

func (p *Property) MoveFields(from, to *Pointer) (res bool)

MoveFields moves fields between items. Only fields in Groups can be moved to another Group, fields in GroupLists will simply be deleted.

func (*Property) MoveListItem

func (p *Property) MoveListItem(ptr *Pointer, i int) (*Group, *GroupList)

func (*Property) Prune

func (p *Property) Prune() (res bool)

func (*Property) RemoveField

func (p *Property) RemoveField(ptr *Pointer)

func (*Property) RemoveFields added in v0.5.0

func (p *Property) RemoveFields(ptr *Pointer) (res bool)

func (*Property) RemoveItem

func (p *Property) RemoveItem(ptr *Pointer)

func (*Property) RemoveListItem

func (p *Property) RemoveListItem(ptr *Pointer) bool

func (*Property) Scene

func (p *Property) Scene() SceneID

func (*Property) Schema

func (p *Property) Schema() SchemaID

func (*Property) SetSchema added in v0.5.0

func (p *Property) SetSchema(schema SchemaID)

func (*Property) UnlinkAllByDataset

func (p *Property) UnlinkAllByDataset(s DatasetSchemaID, ds DatasetID)

func (*Property) UpdateLinkableValue

func (p *Property) UpdateLinkableValue(s *Schema, v *Value)

func (*Property) UpdateValue

func (p *Property) UpdateValue(ps *Schema, ptr *Pointer, v *Value) (*Field, *GroupList, *Group, error)

func (*Property) ValidateSchema

func (p *Property) ValidateSchema(ps *Schema) error

type Rect

type Rect = value.Rect

type SceneID added in v0.4.0

type SceneID = id.SceneID

type Schema

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

func (*Schema) Groups

func (p *Schema) Groups() *SchemaGroupList

func (*Schema) ID

func (p *Schema) ID() SchemaID

func (*Schema) IDRef

func (p *Schema) IDRef() *SchemaID

func (*Schema) LinkableFields

func (p *Schema) LinkableFields() LinkableFields

func (*Schema) Scene added in v0.6.0

func (p *Schema) Scene() *SceneID

func (*Schema) Version

func (p *Schema) Version() int

type SchemaBuilder

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

func NewSchema

func NewSchema() *SchemaBuilder

func (*SchemaBuilder) Build

func (b *SchemaBuilder) Build() (*Schema, error)

func (*SchemaBuilder) Groups

func (b *SchemaBuilder) Groups(groups *SchemaGroupList) *SchemaBuilder

func (*SchemaBuilder) ID

func (*SchemaBuilder) LinkableFields

func (b *SchemaBuilder) LinkableFields(l LinkableFields) *SchemaBuilder

func (*SchemaBuilder) MustBuild

func (b *SchemaBuilder) MustBuild() *Schema

func (*SchemaBuilder) Version

func (b *SchemaBuilder) Version(version int) *SchemaBuilder

type SchemaDiff added in v0.5.0

type SchemaDiff struct {
	From        SchemaID
	To          SchemaID
	Deleted     []SchemaDiffDeleted
	Moved       []SchemaDiffMoved
	TypeChanged []SchemaDiffTypeChanged
}

func SchemaDiffFrom added in v0.5.0

func SchemaDiffFrom(old, new *Schema) (d SchemaDiff)

func SchemaDiffFromProperty added in v0.5.0

func SchemaDiffFromProperty(old *Property, new *Schema) (d SchemaDiff)

func (*SchemaDiff) IsEmpty added in v0.5.0

func (d *SchemaDiff) IsEmpty() bool

func (*SchemaDiff) IsIDChanged added in v0.5.0

func (d *SchemaDiff) IsIDChanged() bool

func (*SchemaDiff) Migrate added in v0.5.0

func (d *SchemaDiff) Migrate(p *Property) (res bool)

type SchemaDiffDeleted added in v0.5.0

type SchemaDiffDeleted SchemaFieldPointer

type SchemaDiffList added in v0.5.0

type SchemaDiffList []SchemaDiff

func (SchemaDiffList) FindByFrom added in v0.5.0

func (l SchemaDiffList) FindByFrom(from SchemaID) *SchemaDiff

func (SchemaDiffList) FromSchemas added in v0.5.0

func (l SchemaDiffList) FromSchemas() []SchemaID

type SchemaDiffMoved added in v0.5.0

type SchemaDiffMoved struct {
	From   SchemaFieldPointer
	To     SchemaFieldPointer
	ToList bool
}

type SchemaDiffTypeChanged added in v0.5.0

type SchemaDiffTypeChanged struct {
	SchemaFieldPointer
	NewType ValueType
}

type SchemaField

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

func (*SchemaField) Choice

func (p *SchemaField) Choice(key string) *SchemaFieldChoice

func (*SchemaField) Choices

func (p *SchemaField) Choices() []SchemaFieldChoice

func (*SchemaField) DefaultValue

func (p *SchemaField) DefaultValue() *Value

func (*SchemaField) Description

func (p *SchemaField) Description() i18n.String

func (*SchemaField) ID

func (p *SchemaField) ID() FieldID

func (*SchemaField) IsAvailableIf

func (p *SchemaField) IsAvailableIf() *Condition

func (*SchemaField) Max

func (p *SchemaField) Max() *float64

func (*SchemaField) Min

func (p *SchemaField) Min() *float64

func (*SchemaField) MinMax

func (p *SchemaField) MinMax() (*float64, *float64)

func (*SchemaField) Prefix

func (p *SchemaField) Prefix() string

func (*SchemaField) SetDescription

func (p *SchemaField) SetDescription(des i18n.String)

func (*SchemaField) SetTitle

func (p *SchemaField) SetTitle(title i18n.String)

func (*SchemaField) Suffix

func (p *SchemaField) Suffix() string

func (*SchemaField) Title

func (p *SchemaField) Title() i18n.String

func (*SchemaField) Type

func (p *SchemaField) Type() ValueType

func (*SchemaField) UI

func (p *SchemaField) UI() *SchemaFieldUI

func (*SchemaField) Validate

func (p *SchemaField) Validate(value *OptionalValue) bool

type SchemaFieldBuilder

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

func NewSchemaField

func NewSchemaField() *SchemaFieldBuilder

func (*SchemaFieldBuilder) Build

func (b *SchemaFieldBuilder) Build() (*SchemaField, error)

func (*SchemaFieldBuilder) Choices

func (*SchemaFieldBuilder) DefaultValue

func (b *SchemaFieldBuilder) DefaultValue(v *Value) *SchemaFieldBuilder

func (*SchemaFieldBuilder) Description

func (b *SchemaFieldBuilder) Description(description i18n.String) *SchemaFieldBuilder

func (*SchemaFieldBuilder) ID

func (*SchemaFieldBuilder) IsAvailableIf

func (b *SchemaFieldBuilder) IsAvailableIf(cond *Condition) *SchemaFieldBuilder

func (*SchemaFieldBuilder) Max

func (*SchemaFieldBuilder) MaxRef

func (*SchemaFieldBuilder) Min

func (*SchemaFieldBuilder) MinRef

func (*SchemaFieldBuilder) MustBuild

func (b *SchemaFieldBuilder) MustBuild() *SchemaField

func (*SchemaFieldBuilder) Name

func (*SchemaFieldBuilder) Prefix

func (b *SchemaFieldBuilder) Prefix(prefix string) *SchemaFieldBuilder

func (*SchemaFieldBuilder) Suffix

func (b *SchemaFieldBuilder) Suffix(suffix string) *SchemaFieldBuilder

func (*SchemaFieldBuilder) Type

func (b *SchemaFieldBuilder) Type(propertyType ValueType) *SchemaFieldBuilder

func (*SchemaFieldBuilder) UI

func (*SchemaFieldBuilder) UIRef

type SchemaFieldChoice

type SchemaFieldChoice struct {
	Key   string
	Title i18n.String
	Icon  string
}

func (SchemaFieldChoice) Copy

func (*SchemaFieldChoice) SetTitle

func (c *SchemaFieldChoice) SetTitle(l i18n.String)

type SchemaFieldPointer added in v0.5.0

type SchemaFieldPointer struct {
	SchemaGroup SchemaGroupID
	Field       FieldID
}

func (*SchemaFieldPointer) Clone added in v0.5.0

func (SchemaFieldPointer) Pointer added in v0.5.0

func (p SchemaFieldPointer) Pointer() *Pointer

type SchemaFieldUI

type SchemaFieldUI string
const (
	SchemaFieldUIMultiline  SchemaFieldUI = "multiline"
	SchemaFieldUISelection  SchemaFieldUI = "selection"
	SchemaFieldUIColor      SchemaFieldUI = "color"
	SchemaFieldUIRange      SchemaFieldUI = "range"
	SchemaFieldUISlider     SchemaFieldUI = "slider"
	SchemaFieldUIImage      SchemaFieldUI = "image"
	SchemaFieldUIVideo      SchemaFieldUI = "video"
	SchemaFieldUIFile       SchemaFieldUI = "file"
	SchemaFieldUILayer      SchemaFieldUI = "layer"
	SchemaFieldUICameraPose SchemaFieldUI = "camera_pose"
	SchemaFieldUIDatetTime  SchemaFieldUI = "datetime"
)

func SchemaFieldUIFrom

func SchemaFieldUIFrom(ui string) SchemaFieldUI

func SchemaFieldUIFromRef

func SchemaFieldUIFromRef(ui *string) *SchemaFieldUI

func (SchemaFieldUI) String

func (p SchemaFieldUI) String() string

func (*SchemaFieldUI) StringRef

func (p *SchemaFieldUI) StringRef() *string

type SchemaGroup

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

SchemaGroup represents a group of property that has some fields

func (*SchemaGroup) Field

func (s *SchemaGroup) Field(fid FieldID) *SchemaField

Field returns a field whose id is specified

func (*SchemaGroup) FieldByPointer

func (s *SchemaGroup) FieldByPointer(ptr *Pointer) *SchemaField

FieldByPointer returns a field whose id is specified

func (*SchemaGroup) Fields

func (s *SchemaGroup) Fields() []*SchemaField

Fields returns a slice of fields

func (*SchemaGroup) HasField

func (s *SchemaGroup) HasField(i FieldID) bool

func (*SchemaGroup) ID

func (s *SchemaGroup) ID() SchemaGroupID

ID returns id

func (*SchemaGroup) IDRef

func (s *SchemaGroup) IDRef() *SchemaGroupID

func (*SchemaGroup) IsAvailableIf

func (s *SchemaGroup) IsAvailableIf() *Condition

IsAvailableIf returns condition of availability

func (*SchemaGroup) IsList

func (s *SchemaGroup) IsList() bool

IsList returns true if this group is list

func (*SchemaGroup) RepresentativeField

func (s *SchemaGroup) RepresentativeField() *SchemaField

RepresentativeField returns the representative field of the group

func (*SchemaGroup) RepresentativeFieldID

func (s *SchemaGroup) RepresentativeFieldID() *FieldID

RepresentativeFieldID returns the representative field ID of the group

func (*SchemaGroup) SetTitle

func (s *SchemaGroup) SetTitle(t i18n.String)

func (*SchemaGroup) Title

func (s *SchemaGroup) Title() i18n.String

Title returns a title of the group

type SchemaGroupAndField added in v0.5.0

type SchemaGroupAndField struct {
	Group *SchemaGroup
	Field *SchemaField
}

func (SchemaGroupAndField) IsEmpty added in v0.5.0

func (gf SchemaGroupAndField) IsEmpty() bool

func (SchemaGroupAndField) Pointer added in v0.5.0

func (gf SchemaGroupAndField) Pointer() *Pointer

func (SchemaGroupAndField) SchemaFieldPointer added in v0.5.0

func (f SchemaGroupAndField) SchemaFieldPointer() SchemaFieldPointer

type SchemaGroupBuilder

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

func NewSchemaGroup

func NewSchemaGroup() *SchemaGroupBuilder

func (*SchemaGroupBuilder) Build

func (b *SchemaGroupBuilder) Build() (*SchemaGroup, error)

func (*SchemaGroupBuilder) Fields

func (b *SchemaGroupBuilder) Fields(fields []*SchemaField) *SchemaGroupBuilder

func (*SchemaGroupBuilder) ID

func (*SchemaGroupBuilder) IsAvailableIf

func (b *SchemaGroupBuilder) IsAvailableIf(cond *Condition) *SchemaGroupBuilder

func (*SchemaGroupBuilder) IsList

func (b *SchemaGroupBuilder) IsList(list bool) *SchemaGroupBuilder

func (*SchemaGroupBuilder) MustBuild

func (b *SchemaGroupBuilder) MustBuild() *SchemaGroup

func (*SchemaGroupBuilder) RepresentativeField

func (b *SchemaGroupBuilder) RepresentativeField(representativeField *FieldID) *SchemaGroupBuilder

func (*SchemaGroupBuilder) Title

type SchemaGroupID added in v0.4.0

type SchemaGroupID = id.PropertySchemaGroupID

type SchemaGroupList added in v0.5.0

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

func NewSchemaGroupList added in v0.5.0

func NewSchemaGroupList(p []*SchemaGroup) *SchemaGroupList

func (*SchemaGroupList) Field added in v0.5.0

func (p *SchemaGroupList) Field(id FieldID) *SchemaField

func (*SchemaGroupList) Fields added in v0.5.0

func (p *SchemaGroupList) Fields() []*SchemaField

func (*SchemaGroupList) Group added in v0.5.0

func (*SchemaGroupList) GroupAndField added in v0.5.0

func (p *SchemaGroupList) GroupAndField(f FieldID) *SchemaGroupAndField

func (*SchemaGroupList) GroupAndFields added in v0.5.0

func (p *SchemaGroupList) GroupAndFields() []SchemaGroupAndField

func (*SchemaGroupList) GroupByField added in v0.5.0

func (p *SchemaGroupList) GroupByField(id FieldID) *SchemaGroup

func (*SchemaGroupList) Groups added in v0.5.0

func (p *SchemaGroupList) Groups() []*SchemaGroup

func (*SchemaGroupList) Len added in v0.5.0

func (p *SchemaGroupList) Len() int

type SchemaID added in v0.4.0

type SchemaID = id.PropertySchemaID

type SchemaList

type SchemaList []*Schema

func (SchemaList) Concat added in v0.6.0

func (l SchemaList) Concat(m SchemaList) SchemaList

func (SchemaList) Find added in v0.4.0

func (l SchemaList) Find(psid SchemaID) *Schema

func (SchemaList) Loader added in v0.4.0

func (l SchemaList) Loader() SchemaLoader

func (SchemaList) Map

func (l SchemaList) Map() SchemaMap

func (SchemaList) MapToIDs added in v0.6.0

func (l SchemaList) MapToIDs(ids []SchemaID) SchemaList

type SchemaLoader

type SchemaLoader func(context.Context, ...SchemaID) (SchemaList, error)

func SchemaLoaderFromMap added in v0.4.0

func SchemaLoaderFromMap(data map[SchemaID]*Schema) SchemaLoader

type SchemaMap

type SchemaMap map[SchemaID]*Schema

func SchemaMapFrom

func SchemaMapFrom(l []*Schema) SchemaMap

func (SchemaMap) Add

func (m SchemaMap) Add(schemas ...*Schema)

func (SchemaMap) Clone

func (m SchemaMap) Clone() SchemaMap

func (SchemaMap) List

func (m SchemaMap) List() SchemaList

func (SchemaMap) Loader added in v0.4.0

func (m SchemaMap) Loader() SchemaLoader

func (SchemaMap) Merge

func (m SchemaMap) Merge(m2 SchemaMap) SchemaMap

type Sealed

type Sealed struct {
	Original      *ID
	Parent        *ID
	Schema        SchemaID
	LinkedDataset *DatasetID
	Items         []*SealedItem
}

func Seal

func Seal(ctx context.Context, p *Merged, d dataset.GraphLoader) (*Sealed, error)

func SealProperty

func SealProperty(ctx context.Context, p *Property) *Sealed

func (*Sealed) Field

func (s *Sealed) Field(id FieldID) *SealedField

func (*Sealed) FieldBy

func (s *Sealed) FieldBy(ptr *Pointer) *SealedField

func (*Sealed) Interface

func (s *Sealed) Interface() map[string]interface{}

func (*Sealed) Item

func (s *Sealed) Item(i ItemID) *SealedItem

func (*Sealed) ItemBy

func (s *Sealed) ItemBy(ptr *Pointer) *SealedItem

func (*Sealed) ItemBySchemaGroup

func (s *Sealed) ItemBySchemaGroup(i SchemaGroupID) *SealedItem

type SealedField

type SealedField struct {
	ID  FieldID
	Val *ValueAndDatasetValue
}

func (*SealedField) Value added in v0.3.0

func (f *SealedField) Value() *Value

type SealedItem

type SealedItem struct {
	Original      *ItemID
	Parent        *ItemID
	SchemaGroup   SchemaGroupID
	LinkedDataset *DatasetID
	Fields        []*SealedField
	Groups        []*SealedItem
}

func (*SealedItem) Field

func (s *SealedItem) Field(id FieldID) *SealedField

func (*SealedItem) Group

func (s *SealedItem) Group(id ItemID) *SealedItem

func (*SealedItem) Interface

func (s *SealedItem) Interface() interface{}

func (*SealedItem) Match

func (s *SealedItem) Match(id ItemID) bool

type TextAlign

type TextAlign string
const (
	TextAlignLeft       TextAlign = "left"
	TextAlignCenter     TextAlign = "center"
	TextAlignRight      TextAlign = "right"
	TextAlignJustify    TextAlign = "justify"
	TextAlignJustifyAll TextAlign = "justify_all"
)

func TextAlignFrom

func TextAlignFrom(t string) (TextAlign, bool)

func TextAlignFromRef

func TextAlignFromRef(t *string) *TextAlign

func (TextAlign) String

func (t TextAlign) String() string

func (*TextAlign) StringRef

func (t *TextAlign) StringRef() *string

type Typography

type Typography struct {
	FontFamily *string    `json:"fontFamily" mapstructure:"fontFamily"`
	FontWeight *string    `json:"fontWeight" mapstructure:"fontWeight"`
	FontSize   *int       `json:"fontSize" mapstructure:"fontSize"`
	Color      *string    `json:"color" mapstructure:"color"`
	TextAlign  *TextAlign `json:"textAlign" mapstructure:"textAlign"`
	Bold       *bool      `json:"bold" mapstructure:"bold"`
	Italic     *bool      `json:"italic" mapstructure:"italic"`
	Underline  *bool      `json:"underline" mapstructure:"underline"`
}

func (*Typography) Clone

func (t *Typography) Clone() *Typography

type Validator

type Validator struct {
	SchemaLoader SchemaLoader
}

func (Validator) Validate

func (v Validator) Validate(ctx context.Context, properties List) error

type Value

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

func ValueFromStringOrNumber added in v0.3.0

func ValueFromStringOrNumber(s string) *Value

func (*Value) Cast added in v0.3.0

func (v *Value) Cast(vt ValueType) *Value

func (*Value) Clone

func (v *Value) Clone() *Value

func (*Value) Interface

func (v *Value) Interface() interface{}

func (*Value) IsEmpty

func (v *Value) IsEmpty() bool

func (*Value) Some added in v0.4.0

func (v *Value) Some() *OptionalValue

func (*Value) Type

func (v *Value) Type() ValueType

func (*Value) Value

func (v *Value) Value() interface{}

func (*Value) ValueBool

func (v *Value) ValueBool() *bool

func (*Value) ValueCamera

func (v *Value) ValueCamera() (vv Camera, ok bool)

func (*Value) ValueCoordinates

func (v *Value) ValueCoordinates() *Coordinates

func (*Value) ValueLatLng

func (v *Value) ValueLatLng() *LatLng

func (*Value) ValueLatLngHeight

func (v *Value) ValueLatLngHeight() *LatLngHeight

func (*Value) ValueNumber

func (v *Value) ValueNumber() *float64

func (*Value) ValuePolygon

func (v *Value) ValuePolygon() *Polygon

func (*Value) ValueRect

func (v *Value) ValueRect() *Rect

func (*Value) ValueRef

func (v *Value) ValueRef() *string

func (*Value) ValueString

func (v *Value) ValueString() *string

func (*Value) ValueTypography

func (v *Value) ValueTypography() (vv Typography, ok bool)

func (*Value) ValueURL

func (v *Value) ValueURL() *url.URL

type ValueAndDatasetValue added in v0.3.0

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

func NewValueAndDatasetValue added in v0.3.0

func NewValueAndDatasetValue(ty ValueType, d *dataset.Value, p *Value) *ValueAndDatasetValue

func (*ValueAndDatasetValue) DatasetValue added in v0.3.0

func (v *ValueAndDatasetValue) DatasetValue() *dataset.Value

func (*ValueAndDatasetValue) PropertyValue added in v0.3.0

func (v *ValueAndDatasetValue) PropertyValue() *Value

func (*ValueAndDatasetValue) Type added in v0.3.0

func (v *ValueAndDatasetValue) Type() ValueType

func (*ValueAndDatasetValue) Value added in v0.3.0

func (v *ValueAndDatasetValue) Value() *Value

type ValueType

type ValueType value.Type

func (ValueType) Default added in v0.4.0

func (t ValueType) Default() bool

func (ValueType) MustBeValue

func (vt ValueType) MustBeValue(i interface{}) *Value

func (ValueType) None added in v0.4.0

func (vt ValueType) None() *OptionalValue

func (ValueType) Valid added in v0.3.0

func (vt ValueType) Valid() bool

func (ValueType) ValueFrom

func (vt ValueType) ValueFrom(i interface{}) *Value

Jump to

Keyboard shortcuts

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