meta

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: Apache-2.0 Imports: 7 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 ParseFloat32Slice added in v1.3.2

func ParseFloat32Slice(val string) ([]float32, error)

func ParseFloat64Slice added in v1.3.2

func ParseFloat64Slice(val string) ([]float64, error)

func ParseInt32Slice added in v1.3.2

func ParseInt32Slice(val string) ([]int32, error)

func ParseInt64Slice added in v1.3.2

func ParseInt64Slice(val string) ([]int64, error)

func ParseIntSlice added in v1.3.2

func ParseIntSlice(val string) ([]int, error)

func ParseMetaValue

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

解析Meta值

func ParseStrSlice added in v1.3.2

func ParseStrSlice(val string) ([]string, error)

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 struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

网关上下文

func FromMeta

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

func NewMeta

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

func ToMeta added in v1.3.2

func ToMeta(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) Id added in v1.3.2

func (m *Meta) Id() 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) Len added in v1.3.2

func (m *Meta) Len() int

func (*Meta) Metadata

func (m *Meta) Metadata() metadata.Metadata

func (*Meta) Name added in v1.3.2

func (m *Meta) Name() string

func (*Meta) Set

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

func (*Meta) SetId added in v1.3.2

func (m *Meta) SetId(id string)

func (*Meta) SetMetadata

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

func (*Meta) SetName added in v1.3.2

func (m *Meta) SetName(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   // 节点ID
	NodeName() string // 节点名称
	Context() context.Context
}

普通节点

Jump to

Keyboard shortcuts

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