model

package
v1.2.0-beta Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrApply = errors.New("")
View Source
var ErrInvalidEmbedded = errors.New("invalid embedded")

ErrInvalidEmbedded represent an error where ....

View Source
var ErrModel = errors.New("")
View Source
var ErrStructNode = errors.New("")
View Source
var ErrUninitializedKey = errors.New("uninitialized key")

ErrUninitializedKey represent an error where ....

Functions

This section is empty.

Types

type ApplyError

type ApplyError struct {
	merror.MError
}

func (ApplyError) Is

func (ApplyError) Is(err error) bool

type ExpandList

type ExpandList []ExpandOp

func (ExpandList) ApplyOn

func (s ExpandList) ApplyOn(g internal.Expander) error

func (*ExpandList) Count

func (s *ExpandList) Count() int

func (*ExpandList) Push

func (s *ExpandList) Push(o ExpandOp)

type ExpandListInterface

type ExpandListInterface interface {
	ApplyOn(g internal.Expander) error
	Push(o ExpandOp)
	Count() int
}

type ExpandOp

type ExpandOp func(g internal.Expander) (
	err error,
)

type FieldNameCollisionError

type FieldNameCollisionError struct {
	Path1 string
	Path2 string
}

func (FieldNameCollisionError) Error

func (u FieldNameCollisionError) Error() string

type GetList

type GetList []GetOp

func (GetList) ApplyOn

func (s GetList) ApplyOn(g internal.Getter) (fvalue.Values, error)

func (*GetList) Count

func (s *GetList) Count() int

func (*GetList) Push

func (s *GetList) Push(o GetOp)

type GetListInterface

type GetListInterface interface {
	ApplyOn(g internal.Getter) (fvalue.Values, error)
	Push(o GetOp)
	Count() int
}

type GetOp

type GetOp func(g internal.Getter) (
	uid uint,
	fieldValue *fvalue.Value,
	err error,
)

type IndexedSubNode

type IndexedSubNode struct {
	Node  Node
	Index []int
}

type IndexedSubNodes

type IndexedSubNodes []*IndexedSubNode

func (IndexedSubNodes) GetIndexes

func (i IndexedSubNodes) GetIndexes() [][]int

type Model

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

func NewModel

func NewModel(inputModelType reflect.Type) (*Model, error)

func (*Model) ApplyOn

func (m *Model) ApplyOn(g internal.Getter) (fvalue.Values, error)

func (*Model) Expand

func (m *Model) Expand(g internal.Expander) error

func (*Model) Fill

func (m *Model) Fill(
	inputModelValue reflect.Value,
	layers []fvalue.Values,
) (plocation.Locations, error)

func (*Model) GetFieldValuesFor

func (m *Model) GetFieldValuesFor(
	id string,
	value reflect.Value,
) fvalue.Values

func (*Model) TypeName

func (m *Model) TypeName() string

type ModelError

type ModelError struct {
	merror.MError
}

func (ModelError) Is

func (ModelError) Is(err error) bool

type Node

type Node interface {
	BuildGetList(s *GetList)
	FeedFieldValues(
		srcID string,
		fieldValues fvalue.Values,
		value reflect.Value,
	)
	Fill(
		value reflect.Value,
		layers []fvalue.Values,
	) (plocation.Locations, error)
	BuildExpandList(e *ExpandList)
}

type StructNode

type StructNode struct {
	Type        reflect.Type
	VisiblePath string
	Index       IndexedSubNodes
}

func (*StructNode) BuildExpandList

func (n *StructNode) BuildExpandList(el *ExpandList)

func (*StructNode) BuildGetList

func (n *StructNode) BuildGetList(s *GetList)

func (*StructNode) FeedFieldValues

func (n *StructNode) FeedFieldValues(
	srcID string,
	fieldValues fvalue.Values,
	value reflect.Value,
)

func (StructNode) Fill

func (n StructNode) Fill(
	value reflect.Value, layers []fvalue.Values,
) (plocation.Locations, error)

func (*StructNode) PushSubNodes

func (n *StructNode) PushSubNodes(index []int, scanned Node)

type StructNodeError

type StructNodeError struct {
	merror.MError
}

func (StructNodeError) Is

func (StructNodeError) Is(err error) bool

type UnsupportedTypeError

type UnsupportedTypeError struct {
	Type reflect.Type
	Path string
}

func (UnsupportedTypeError) Error

func (u UnsupportedTypeError) Error() string

type ValueNode

type ValueNode struct {
	Type        reflect.Type
	VisiblePath string
	UID         uint
}

func (*ValueNode) BuildExpandList

func (*ValueNode) BuildExpandList(*ExpandList)

func (*ValueNode) BuildGetList

func (n *ValueNode) BuildGetList(s *GetList)

func (*ValueNode) FeedFieldValues

func (n *ValueNode) FeedFieldValues(
	srcID string,
	fieldValues fvalue.Values,
	value reflect.Value,
)

func (*ValueNode) Fill

func (n *ValueNode) Fill(
	value reflect.Value, layers []fvalue.Values,
) (plocation.Locations, error)

Jump to

Keyboard shortcuts

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