Documentation ¶
Index ¶
- Variables
- func Filter(dataset map[string]interface{}, ...) map[string]interface{}
- func FilterByIncludes(dataset map[string]interface{}, includes []string) map[string]interface{}
- func FlatForHighLevel(key string) []string
- func ImpossibleError() error
- func IsKeyIndexNotValid(err error) bool
- func IsKeyTypeNotMatch(err error) bool
- func IsNotExist(err error) bool
- func TypeName(v interface{}) string
- func TypeNameCompare(previous, current string) int
- type Action
- func (*Action) Descriptor() ([]byte, []int)deprecated
- func (x *Action) GetAction() isAction_Action
- func (x *Action) GetDelete() *Delete
- func (x *Action) GetReplace() *Replace
- func (x *Action) GetSet() *Set
- func (x *Action) IsDelete() bool
- func (x *Action) IsReplace() bool
- func (x *Action) IsSet() bool
- func (*Action) ProtoMessage()
- func (x *Action) ProtoReflect() protoreflect.Message
- func (x *Action) Reset()
- func (x *Action) String() string
- func (x *Action) ToStarlark() *ActionStarlark
- func (x *Action) Unwrap() interface{}
- type ActionStarlark
- func (x *ActionStarlark) Attr(name string) (starlark.Value, error)
- func (x *ActionStarlark) AttrNames() []string
- func (x *ActionStarlark) Freeze()
- func (x *ActionStarlark) Hash() (uint32, error)
- func (x *ActionStarlark) String() string
- func (x *ActionStarlark) Truth() starlark.Bool
- func (x *ActionStarlark) Type() string
- type Action_Delete
- type Action_Replace
- type Action_Set
- type Any
- type AnyValue
- type Applier
- type Checker
- type Clearer
- type Cloner
- type Delete
- type DeleteStarlark
- func (x *DeleteStarlark) Attr(name string) (starlark.Value, error)
- func (x *DeleteStarlark) AttrNames() []string
- func (x *DeleteStarlark) Freeze()
- func (x *DeleteStarlark) Hash() (uint32, error)
- func (x *DeleteStarlark) String() string
- func (x *DeleteStarlark) Truth() starlark.Bool
- func (x *DeleteStarlark) Type() string
- type Deleter
- type Dumper
- type ErrKeyIndexNotValid
- type ErrKeyNotExist
- type ErrKeyTypeNotMatch
- type Exporter
- type Getter
- type KeySplitter
- type List
- type Map
- type Provider
- type Replace
- type ReplaceStarlark
- func (x *ReplaceStarlark) Attr(name string) (starlark.Value, error)
- func (x *ReplaceStarlark) AttrNames() []string
- func (x *ReplaceStarlark) Freeze()
- func (x *ReplaceStarlark) Hash() (uint32, error)
- func (x *ReplaceStarlark) String() string
- func (x *ReplaceStarlark) Truth() starlark.Bool
- func (x *ReplaceStarlark) Type() string
- type Set
- type SetStarlark
- func (x *SetStarlark) Attr(name string) (starlark.Value, error)
- func (x *SetStarlark) AttrNames() []string
- func (x *SetStarlark) Freeze()
- func (x *SetStarlark) Hash() (uint32, error)
- func (x *SetStarlark) String() string
- func (x *SetStarlark) Truth() starlark.Bool
- func (x *SetStarlark) Type() string
- type Setter
- type Store
- type TrieNode
- type TrieTree
- type UnsafeApplier
- type UnsafeClearer
- type UnsafeDeleter
- type UnsafeGetter
- type UnsafeLocker
- type UnsafeSetter
- type UnsafeStore
- type Value
Constants ¶
This section is empty.
Variables ¶
var ( NULL = structpb.NewNullValue() TRUE = structpb.NewBoolValue(true) FALSE = structpb.NewBoolValue(false) )
var File_action_proto protoreflect.FileDescriptor
Functions ¶
func FilterByIncludes ¶
FilterByIncludes 将 dataset 中所有不在 includes 或 includes 子元素中的元素筛选掉 dataset 是一个多层数据集合,通常来源于 Export (不能来源于 ExportFlat,因为该函数没有展开逻辑) includes 是一个 key 列表,key 允许存在层级关系,但不允许访问数组子元素 该函数会修改 dataset 如果 includes 为空或 nil 该函数会返回一个空 map
func FlatForHighLevel ¶
FlatForHighLevel 返回所有的上层 key,并保证按长度由小到大排序 例如对于 a.b.c 会返回 [a, a.b, a.b.c]
func ImpossibleError ¶
func ImpossibleError() error
func IsKeyIndexNotValid ¶ added in v0.1.4
func IsKeyTypeNotMatch ¶ added in v0.1.4
func IsNotExist ¶ added in v0.1.4
func TypeName ¶
func TypeName(v interface{}) string
TypeName for Any or AnyValue 返回值可能为 "null", "int", "float", "string", "bool", "map", "list" 对于非 Any 和 AnyValue 的类型均返回 "unknown"
func TypeNameCompare ¶ added in v0.1.17
TypeNameCompare 检查两个类型的包含关系 0 代表相同,-1 代表前者范围更小,1 代表后者返回更小 -2 代表检查不通过(二者无交集)
Types ¶
type Action ¶
type Action struct { // Types that are assignable to Action: // *Action_Set // *Action_Delete // *Action_Replace Action isAction_Action `protobuf_oneof:"action"` // contains filtered or unexported fields }
func JSONToActions ¶
func MapToActions ¶ added in v0.2.1
func NewClearAction ¶ added in v0.2.2
func NewClearAction() *Action
func NewDeleteAction ¶
func NewReplaceAction ¶
func NewSetAction ¶
func (*Action) Descriptor
deprecated
func (*Action) GetReplace ¶
func (*Action) ProtoMessage ¶
func (*Action) ProtoMessage()
func (*Action) ProtoReflect ¶
func (x *Action) ProtoReflect() protoreflect.Message
func (*Action) ToStarlark ¶ added in v0.1.19
func (x *Action) ToStarlark() *ActionStarlark
type ActionStarlark ¶ added in v0.1.19
type ActionStarlark struct { Action starlark.Value Set *SetStarlark Delete *DeleteStarlark Replace *ReplaceStarlark }
func (*ActionStarlark) Attr ¶ added in v0.1.19
func (x *ActionStarlark) Attr(name string) (starlark.Value, error)
func (*ActionStarlark) AttrNames ¶ added in v0.1.19
func (x *ActionStarlark) AttrNames() []string
func (*ActionStarlark) Freeze ¶ added in v0.1.19
func (x *ActionStarlark) Freeze()
func (*ActionStarlark) Hash ¶ added in v0.1.19
func (x *ActionStarlark) Hash() (uint32, error)
func (*ActionStarlark) String ¶ added in v0.1.19
func (x *ActionStarlark) String() string
func (*ActionStarlark) Truth ¶ added in v0.1.19
func (x *ActionStarlark) Truth() starlark.Bool
func (*ActionStarlark) Type ¶ added in v0.1.19
func (x *ActionStarlark) Type() string
type Action_Delete ¶
type Action_Delete struct {
Delete *Delete `protobuf:"bytes,2,opt,name=delete,proto3,oneof"`
}
type Action_Replace ¶
type Action_Replace struct {
Replace *Replace `protobuf:"bytes,3,opt,name=replace,proto3,oneof"`
}
type Action_Set ¶
type Action_Set struct {
Set *Set `protobuf:"bytes,1,opt,name=set,proto3,oneof"`
}
type Any ¶
type Any interface{}
Any 标识着来源于 Value.Unwrap() 的可能返回值 其类型可能为 nil, int64, float64, string, bool, *Map, *List
func ValueToAny ¶
ValueToAny convert AnyValue to Any, 转换为一一对应 需要注意的是,AnyValue 为字符串形式的 float64 (NaN, Infinity) 则会出现不一致
type AnyValue ¶
type AnyValue interface{}
AnyValue 标识着来源于 Value.AsInterface() 的可能返回值 其类型可能为 nil, int64, float64, string, bool, map[string]interface{}, []interface{}
func AnyToValue ¶
AnyToValue convert Any to AnyValue, 转换为一一对应 需要注意的是,与 Value 的 AsInterface 不同,这一函数并不会特别处理 float infinity 和 NaN
type Delete ¶
type Delete struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // contains filtered or unexported fields }
删除一个值
func (*Delete) Descriptor
deprecated
func (*Delete) ProtoMessage ¶
func (*Delete) ProtoMessage()
func (*Delete) ProtoReflect ¶
func (x *Delete) ProtoReflect() protoreflect.Message
func (*Delete) ToStarlark ¶ added in v0.1.19
func (x *Delete) ToStarlark() *DeleteStarlark
type DeleteStarlark ¶ added in v0.1.19
func (*DeleteStarlark) Attr ¶ added in v0.1.19
func (x *DeleteStarlark) Attr(name string) (starlark.Value, error)
func (*DeleteStarlark) AttrNames ¶ added in v0.1.19
func (x *DeleteStarlark) AttrNames() []string
func (*DeleteStarlark) Freeze ¶ added in v0.1.19
func (x *DeleteStarlark) Freeze()
func (*DeleteStarlark) Hash ¶ added in v0.1.19
func (x *DeleteStarlark) Hash() (uint32, error)
func (*DeleteStarlark) String ¶ added in v0.1.19
func (x *DeleteStarlark) String() string
func (*DeleteStarlark) Truth ¶ added in v0.1.19
func (x *DeleteStarlark) Truth() starlark.Bool
func (*DeleteStarlark) Type ¶ added in v0.1.19
func (x *DeleteStarlark) Type() string
type ErrKeyIndexNotValid ¶
func (ErrKeyIndexNotValid) Error ¶
func (e ErrKeyIndexNotValid) Error() string
type ErrKeyNotExist ¶
func (ErrKeyNotExist) Error ¶
func (e ErrKeyNotExist) Error() string
type ErrKeyTypeNotMatch ¶
func (ErrKeyTypeNotMatch) Error ¶
func (e ErrKeyTypeNotMatch) Error() string
type KeySplitter ¶
type List ¶
func NewEmptyList ¶
type Map ¶
func NewEmptyMap ¶
func NewEmptyMap() *Map
type Replace ¶
type Replace struct { New *structpb.Dict `protobuf:"bytes,1,opt,name=new,proto3" json:"new,omitempty"` // contains filtered or unexported fields }
完全替换底层数据
func (*Replace) Descriptor
deprecated
func (*Replace) ProtoMessage ¶
func (*Replace) ProtoMessage()
func (*Replace) ProtoReflect ¶
func (x *Replace) ProtoReflect() protoreflect.Message
func (*Replace) ToStarlark ¶ added in v0.1.19
func (x *Replace) ToStarlark() *ReplaceStarlark
type ReplaceStarlark ¶ added in v0.1.19
func (*ReplaceStarlark) Attr ¶ added in v0.1.19
func (x *ReplaceStarlark) Attr(name string) (starlark.Value, error)
func (*ReplaceStarlark) AttrNames ¶ added in v0.1.19
func (x *ReplaceStarlark) AttrNames() []string
func (*ReplaceStarlark) Freeze ¶ added in v0.1.19
func (x *ReplaceStarlark) Freeze()
func (*ReplaceStarlark) Hash ¶ added in v0.1.19
func (x *ReplaceStarlark) Hash() (uint32, error)
func (*ReplaceStarlark) String ¶ added in v0.1.19
func (x *ReplaceStarlark) String() string
func (*ReplaceStarlark) Truth ¶ added in v0.1.19
func (x *ReplaceStarlark) Truth() starlark.Bool
func (*ReplaceStarlark) Type ¶ added in v0.1.19
func (x *ReplaceStarlark) Type() string
type Set ¶
type Set struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Value *structpb.Value `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
设置一个值
func (*Set) Descriptor
deprecated
func (*Set) ProtoMessage ¶
func (*Set) ProtoMessage()
func (*Set) ProtoReflect ¶
func (x *Set) ProtoReflect() protoreflect.Message
func (*Set) ToStarlark ¶ added in v0.1.19
func (x *Set) ToStarlark() *SetStarlark
type SetStarlark ¶ added in v0.1.19
func (*SetStarlark) Attr ¶ added in v0.1.19
func (x *SetStarlark) Attr(name string) (starlark.Value, error)
func (*SetStarlark) AttrNames ¶ added in v0.1.19
func (x *SetStarlark) AttrNames() []string
func (*SetStarlark) Freeze ¶ added in v0.1.19
func (x *SetStarlark) Freeze()
func (*SetStarlark) Hash ¶ added in v0.1.19
func (x *SetStarlark) Hash() (uint32, error)
func (*SetStarlark) String ¶ added in v0.1.19
func (x *SetStarlark) String() string
func (*SetStarlark) Truth ¶ added in v0.1.19
func (x *SetStarlark) Truth() starlark.Bool
func (*SetStarlark) Type ¶ added in v0.1.19
func (x *SetStarlark) Type() string
type Setter ¶
type Setter interface { SetNull(key string) error SetInt64(key string, value int64) error SetUint64(key string, value uint64) error SetFloat64(key string, value float64) error SetBool(key string, value bool) error SetString(key string, value string) error SetTrue(key string) error SetFalse(key string) error SetList(key string, value []interface{}) error SetMap(key string, value map[string]interface{}) error SetAnyList(key string, value interface{}) error SetStringList(key string, value []string) error SetAnyMap(key string, value interface{}) error }
type Store ¶
type Store interface { Getter Setter Checker Deleter Clearer Applier Cloner Dumper Exporter KeySplitter Unsafe() UnsafeStore }
func CreateStore ¶
func LoadFromJSON ¶
type TrieNode ¶
func (*TrieNode) CheckExist ¶
type UnsafeApplier ¶
type UnsafeApplier interface { UnsafeLocker Applier UnsafeApply(actions []*Action) error UnsafeApplyAction(action *Action) error UnsafeMockApplyAndLock(actions []*Action) (Store, error) UnsafeReplaceInnerWithoutLock(new *Map) }
UnsafeApplier 作用是给予异步操作能力的 其实现目的在于支持先 MockApply 来获得修改后的结果 如果满足一定的条件以后执行 ReplaceInner 进行应用,如果不满足则放弃 然而如果使用 Applier 中的版本,会造成 MockApply 和 ReplaceInner 之间可能会出现修改,导致 ReplaceInner 执行后中间修改丢失 因此使用 UnsafeApplier 的流程为 - UnsafeMockApplyAndLock 获得修改结果,检查 - 如果检查通过,利用 UnsafeReplaceInnerWithoutLock 和 UnsafeLock 应用 - 如果检查失败,利用 UnsafeUnlock 放弃
type UnsafeClearer ¶ added in v0.2.2
type UnsafeClearer interface {
UnsafeClear()
}
type UnsafeDeleter ¶ added in v0.1.5
type UnsafeGetter ¶
type UnsafeLocker ¶
type UnsafeLocker interface { UnsafeLock() UnsafeUnlock() UnsafeRLock() UnsafeRUnlock() }
type UnsafeSetter ¶ added in v0.1.5
type UnsafeStore ¶
type UnsafeStore interface { Store UnsafeGetter UnsafeSetter UnsafeDeleter UnsafeClearer UnsafeApplier UnsafeUnderlying() *Map UnsafeUnderlyingPointer() **Map }
type Value ¶
func AnyValueToValue ¶
AnyValueToValue convert AnyValue to *Value, 转换为一一对应 相比于 NewValue 而言这一函数更加严格(同时效率也更高)
func NewEmptyMapValue ¶
func NewEmptyMapValue() *Value