meta

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2020 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	KeyNodeId   = "Node-Id"
	KeyNodeName = "Node-Name"
)
View Source
const (
	KeyDataId = "Data-Id"
)

Variables

This section is empty.

Functions

func IsSelf

func IsSelf(mt NodeMeta) bool

IsSelf 检查是否自身节点

func IsValid

func IsValid(mt NodeMeta) bool

IsValid 检查节点是否有效

func NewContext

func NewContext(values map[string]string) context.Context

func ParseMetaValue

func ParseMetaValue(val string, res interface{}) error

解析Meta值

func ToMetaValue

func ToMetaValue(value interface{}) string

转换Meta值

Types

type DataMeta

type DataMeta struct {
	Meta
}

数据节点

func FromDataMeta

func FromDataMeta(ctx context.Context) (*DataMeta, error)

func NewDataMeta

func NewDataMeta(name, id string, dataId interface{}) *DataMeta

实例化数据节点

func ToDataMeta

func ToDataMeta(values map[string]string) *DataMeta

func (*DataMeta) DataId

func (m *DataMeta) DataId() string

func (*DataMeta) IsValid

func (m *DataMeta) IsValid() bool

func (*DataMeta) SetDataId

func (m *DataMeta) SetDataId(id interface{})

type DataNodeMeta

type DataNodeMeta interface {
	NodeId() string   // 节点ID
	NodeName() string // 节点名称
	DataId() string   // 数据ID
	Context() context.Context
}

数据节点

type Meta

type Meta metadata.Metadata

网关上下文

func FromMeta

func FromMeta(ctx context.Context) (Meta, error)

func NewMeta

func NewMeta(name, id string, meta metadata.Metadata) Meta

func (Meta) Bool

func (m Meta) Bool(key string) bool

func (Meta) Context

func (m Meta) Context() context.Context

func (Meta) Float32

func (m Meta) Float32(key string) float32

func (Meta) Float64

func (m Meta) Float64(key string) float64

func (Meta) Get

func (m Meta) Get(key string) string

func (Meta) Int

func (m Meta) Int(key string) int

func (Meta) Int32

func (m Meta) Int32(key string) int32

func (Meta) Int64

func (m Meta) Int64(key string) int64

func (Meta) Metadata

func (m Meta) Metadata() metadata.Metadata

func (Meta) NodeId

func (m Meta) NodeId() string

func (Meta) NodeName

func (m Meta) NodeName() string

func (Meta) Set

func (m Meta) Set(key string, val interface{})

func (Meta) SetMetadata

func (m Meta) SetMetadata(values metadata.Metadata)

func (Meta) SetNodeId

func (m Meta) SetNodeId(id string)

func (Meta) SetNodeName

func (m Meta) SetNodeName(name string)

func (Meta) SetValues

func (m Meta) SetValues(values map[string]interface{})

func (Meta) Uint32

func (m Meta) Uint32(key string) uint32

func (Meta) Uint64

func (m Meta) Uint64(key string) uint64

type NodeMeta

type NodeMeta interface {
	NodeId() string
	NodeName() string
	Context() context.Context
}

普通节点

Jump to

Keyboard shortcuts

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