mapper

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TentacleTypeUndefined = "undefined"
	TentacleTypeEntity    = "entity"
	TentacleTypeMapper    = "mapper"

	WatchKeyDelimiter = "."
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Mapper

type Mapper interface {
	// ID returns mapper id.
	ID() string
	// String returns MQL text.
	String() string
	// TargetEntity returns target entity.
	TargetEntity() string
	// SourceEntities returns source entities.
	SourceEntities() map[string][]string
	// Tentacles returns tentacles.
	Tentacles() []Tentacler
	// Copy duplicate a mapper.
	Copy() Mapper
	// Exec excute input returns output.
	Exec(map[string]tdtl.Node) (map[string]tdtl.Node, error)
}

func NewMapper

func NewMapper(id, tqlText string, version int64) (Mapper, error)

type TQLConfig added in v0.4.1

type TQLConfig struct {
	TargetEntity   string
	SourceEntities []string
	Tentacles      []TentacleConfig
}

type TentacleConfig added in v0.4.1

type TentacleConfig struct {
	SourceEntity string
	PropertyKeys []string
}

------------------------.

type TentacleType

type TentacleType = string

type Tentacler

type Tentacler interface {
	// ID return id.
	ID() string
	// Type returns tentacle type.
	Type() TentacleType
	// TargetID returns target id.
	TargetID() string
	// Items returns watch keys(watchKey=entityId#propertyKey).
	Items() []WatchKey
	// Copy duplicate a mapper.
	Copy() Tentacler
	// Version return tentacle version.
	Version() int64
}

func MergeTentacles

func MergeTentacles(tentacles ...Tentacler) Tentacler

func NewTentacle

func NewTentacle(tp TentacleType, targetID string, items []WatchKey, version int64) Tentacler

type WatchKey

type WatchKey struct {
	EntityID    string
	PropertyKey string
}

func (*WatchKey) String

func (wk *WatchKey) String() string

Jump to

Keyboard shortcuts

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