mapitf

package
v1.0.19 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmptyDataType = "empty_data"
	ListDataType  = "list"
	MapDataType   = "map"
)

Variables

This section is empty.

Functions

func From

func From(itf interface{}) api.MapInterface

-------------------Enter/入口-------------------------------------

Types

type BaseItfImpl

type BaseItfImpl struct {
	Class     string
	IterVal   interface{}
	IterLevel int
	ItfErr    *itferr.MapItfError
}

func (*BaseItfImpl) Exist

func (b *BaseItfImpl) Exist(key interface{}) (interface{}, bool)

func (*BaseItfImpl) ForEach

func (b *BaseItfImpl) ForEach(forFunc api.ForFunc) api.MapInterface

func (*BaseItfImpl) Get

func (b *BaseItfImpl) Get(key interface{}) api.MapInterface

Interface ----------------------------------------------------------------------------------------

func (*BaseItfImpl) GetAny

func (b *BaseItfImpl) GetAny(keys ...interface{}) api.MapInterface

func (*BaseItfImpl) GetByInterface

func (b *BaseItfImpl) GetByInterface(key interface{}) (itfVal interface{}, err *itferr.MapItfError)

GetByInterface 如果key的类型和Map[k]v中k类型不一致会panic

func (*BaseItfImpl) Index

func (b *BaseItfImpl) Index(index int) api.MapInterface

func (*BaseItfImpl) ToBool

func (b *BaseItfImpl) ToBool() (bool, error)

func (*BaseItfImpl) ToByte

func (b *BaseItfImpl) ToByte() ([]byte, error)

func (*BaseItfImpl) ToFloat32

func (b *BaseItfImpl) ToFloat32() (float32, error)

func (*BaseItfImpl) ToFloat64

func (b *BaseItfImpl) ToFloat64() (float64, error)

func (*BaseItfImpl) ToInt

func (b *BaseItfImpl) ToInt() (int, error)

func (*BaseItfImpl) ToInt32

func (b *BaseItfImpl) ToInt32() (int32, error)

func (*BaseItfImpl) ToInt64

func (b *BaseItfImpl) ToInt64() (int64, error)

func (*BaseItfImpl) ToList

func (b *BaseItfImpl) ToList() ([]interface{}, error)

ToArrayType ----------------------------------------------------------------------------------------

func (*BaseItfImpl) ToListBool

func (b *BaseItfImpl) ToListBool() ([]bool, error)

func (*BaseItfImpl) ToListFloat32

func (b *BaseItfImpl) ToListFloat32() ([]float32, error)

func (*BaseItfImpl) ToListFloat64

func (b *BaseItfImpl) ToListFloat64() ([]float64, error)

func (*BaseItfImpl) ToListInt

func (b *BaseItfImpl) ToListInt() ([]int, error)

func (*BaseItfImpl) ToListInt32

func (b *BaseItfImpl) ToListInt32() ([]int32, error)

func (*BaseItfImpl) ToListInt64

func (b *BaseItfImpl) ToListInt64() ([]int64, error)

func (*BaseItfImpl) ToListStr

func (b *BaseItfImpl) ToListStr() ([]string, error)

func (*BaseItfImpl) ToListStrF

func (b *BaseItfImpl) ToListStrF() ([]string, error)

func (*BaseItfImpl) ToListUint

func (b *BaseItfImpl) ToListUint() ([]uint, error)

func (*BaseItfImpl) ToListUint32

func (b *BaseItfImpl) ToListUint32() ([]uint32, error)

func (*BaseItfImpl) ToListUint64

func (b *BaseItfImpl) ToListUint64() ([]uint64, error)

func (*BaseItfImpl) ToMap

func (b *BaseItfImpl) ToMap() (map[string]interface{}, error)

ToMapType ----------------------------------------------------------------------------------------

func (*BaseItfImpl) ToMapFloat32

func (b *BaseItfImpl) ToMapFloat32() (map[float32]interface{}, error)

func (*BaseItfImpl) ToMapFloat32ToFloat32

func (b *BaseItfImpl) ToMapFloat32ToFloat32() (map[float32]float32, error)

func (*BaseItfImpl) ToMapFloat64

func (b *BaseItfImpl) ToMapFloat64() (map[float64]interface{}, error)

func (*BaseItfImpl) ToMapFloat64ToFloat64

func (b *BaseItfImpl) ToMapFloat64ToFloat64() (map[float64]float64, error)

func (*BaseItfImpl) ToMapInt

func (b *BaseItfImpl) ToMapInt() (map[int]interface{}, error)

func (*BaseItfImpl) ToMapInt32

func (b *BaseItfImpl) ToMapInt32() (map[int32]interface{}, error)

func (*BaseItfImpl) ToMapInt64

func (b *BaseItfImpl) ToMapInt64() (map[int64]interface{}, error)

func (*BaseItfImpl) ToMapInt64ToInt64

func (b *BaseItfImpl) ToMapInt64ToInt64() (map[int64]int64, error)

func (*BaseItfImpl) ToMapIntToInt

func (b *BaseItfImpl) ToMapIntToInt() (map[int]int, error)

func (*BaseItfImpl) ToMapItf

func (b *BaseItfImpl) ToMapItf() (map[interface{}]interface{}, error)

func (*BaseItfImpl) ToMapStrToStr

func (b *BaseItfImpl) ToMapStrToStr() (map[string]string, error)

func (*BaseItfImpl) ToMapUint

func (b *BaseItfImpl) ToMapUint() (map[uint]interface{}, error)

func (*BaseItfImpl) ToMapUint32

func (b *BaseItfImpl) ToMapUint32() (map[uint32]interface{}, error)

func (*BaseItfImpl) ToMapUint64

func (b *BaseItfImpl) ToMapUint64() (map[uint64]interface{}, error)

func (*BaseItfImpl) ToStr

func (b *BaseItfImpl) ToStr() (string, error)

func (*BaseItfImpl) ToUint

func (b *BaseItfImpl) ToUint() (uint, error)

func (*BaseItfImpl) ToUint32

func (b *BaseItfImpl) ToUint32() (uint32, error)

func (*BaseItfImpl) ToUint64

func (b *BaseItfImpl) ToUint64() (uint64, error)

func (*BaseItfImpl) Val

func (b *BaseItfImpl) Val() (interface{}, error)

func (*BaseItfImpl) Valid

func (b *BaseItfImpl) Valid() bool

type BasicItf

type BasicItf interface {
	api.MapInterface
}

type BasicItfImpl

type BasicItfImpl struct {
	BaseItfImpl

	OriginItf interface{}
}

func (*BasicItfImpl) Get

func (m *BasicItfImpl) Get(key interface{}) api.MapInterface

func (*BasicItfImpl) GetAny

func (m *BasicItfImpl) GetAny(keys ...interface{}) api.MapInterface

func (*BasicItfImpl) Index

func (m *BasicItfImpl) Index(index int) api.MapInterface

type BasicListItf

type BasicListItf interface {
	api.MapInterface
}

type BasicListItfImpl

type BasicListItfImpl struct {
	BaseItfImpl

	OriginItf interface{}
}

func (*BasicListItfImpl) Get

func (m *BasicListItfImpl) Get(key interface{}) api.MapInterface

func (*BasicListItfImpl) GetAny

func (m *BasicListItfImpl) GetAny(keys ...interface{}) api.MapInterface

func (*BasicListItfImpl) Index

func (m *BasicListItfImpl) Index(index int) api.MapInterface

type DataType

type DataType string

type ExceptItf

type ExceptItf interface {
	api.MapInterface
}

func NewExceptItfImpl

func NewExceptItfImpl() ExceptItf

func NewExceptItfImplErr

func NewExceptItfImplErr(err *itferr.MapItfError) ExceptItf

type ExceptItfImpl

type ExceptItfImpl struct {
	BaseItfImpl
}

MapStrItfImpl 典型实现,整个通过接口交互,对外封闭,对内开放

func (*ExceptItfImpl) Get

func (e *ExceptItfImpl) Get(key interface{}) api.MapInterface

type ForeachItf

type ForeachItf interface {
	api.MapInterface
}

func NewForeachItfImpl

func NewForeachItfImpl(list []interface{}, m map[interface{}]interface{}) ForeachItf

type ForeachItfImpl

type ForeachItfImpl struct {
	BaseItfImpl

	DataType DataType
	ListItf  []interface{}
	MapItf   map[interface{}]interface{}
}

func (*ForeachItfImpl) Get

func (m *ForeachItfImpl) Get(key interface{}) api.MapInterface

func (*ForeachItfImpl) GetAny

func (m *ForeachItfImpl) GetAny(keys ...interface{}) api.MapInterface

func (*ForeachItfImpl) Index

func (m *ForeachItfImpl) Index(index int) api.MapInterface

func (*ForeachItfImpl) ToList

func (m *ForeachItfImpl) ToList() ([]interface{}, error)

func (*ForeachItfImpl) ToListBool

func (m *ForeachItfImpl) ToListBool() ([]bool, error)

func (*ForeachItfImpl) ToListFloat32

func (m *ForeachItfImpl) ToListFloat32() ([]float32, error)

func (*ForeachItfImpl) ToListFloat64

func (m *ForeachItfImpl) ToListFloat64() ([]float64, error)

func (*ForeachItfImpl) ToListInt

func (m *ForeachItfImpl) ToListInt() ([]int, error)

func (*ForeachItfImpl) ToListInt32

func (m *ForeachItfImpl) ToListInt32() ([]int32, error)

func (*ForeachItfImpl) ToListInt64

func (m *ForeachItfImpl) ToListInt64() ([]int64, error)

func (*ForeachItfImpl) ToListStr

func (m *ForeachItfImpl) ToListStr() ([]string, error)

func (*ForeachItfImpl) ToListStrF

func (m *ForeachItfImpl) ToListStrF() ([]string, error)

func (*ForeachItfImpl) ToListUint

func (m *ForeachItfImpl) ToListUint() ([]uint, error)

func (*ForeachItfImpl) ToListUint32

func (m *ForeachItfImpl) ToListUint32() ([]uint32, error)

func (*ForeachItfImpl) ToListUint64

func (m *ForeachItfImpl) ToListUint64() ([]uint64, error)

func (*ForeachItfImpl) ToMap

func (m *ForeachItfImpl) ToMap() (map[string]interface{}, error)

func (*ForeachItfImpl) ToMapFloat32

func (m *ForeachItfImpl) ToMapFloat32() (map[float32]interface{}, error)

func (*ForeachItfImpl) ToMapFloat32ToFloat32

func (m *ForeachItfImpl) ToMapFloat32ToFloat32() (map[float32]float32, error)

func (*ForeachItfImpl) ToMapFloat64

func (m *ForeachItfImpl) ToMapFloat64() (map[float64]interface{}, error)

func (*ForeachItfImpl) ToMapFloat64ToFloat64

func (m *ForeachItfImpl) ToMapFloat64ToFloat64() (map[float64]float64, error)

func (*ForeachItfImpl) ToMapInt

func (m *ForeachItfImpl) ToMapInt() (map[int]interface{}, error)

func (*ForeachItfImpl) ToMapInt32

func (m *ForeachItfImpl) ToMapInt32() (map[int32]interface{}, error)

func (*ForeachItfImpl) ToMapInt64

func (m *ForeachItfImpl) ToMapInt64() (map[int64]interface{}, error)

func (*ForeachItfImpl) ToMapInt64ToInt64

func (m *ForeachItfImpl) ToMapInt64ToInt64() (map[int64]int64, error)

func (*ForeachItfImpl) ToMapIntToInt

func (m *ForeachItfImpl) ToMapIntToInt() (map[int]int, error)

func (*ForeachItfImpl) ToMapItf

func (m *ForeachItfImpl) ToMapItf() (map[interface{}]interface{}, error)

func (*ForeachItfImpl) ToMapStrToStr

func (m *ForeachItfImpl) ToMapStrToStr() (map[string]string, error)

func (*ForeachItfImpl) ToMapUint

func (m *ForeachItfImpl) ToMapUint() (map[uint]interface{}, error)

func (*ForeachItfImpl) ToMapUint32

func (m *ForeachItfImpl) ToMapUint32() (map[uint32]interface{}, error)

func (*ForeachItfImpl) ToMapUint64

func (m *ForeachItfImpl) ToMapUint64() (map[uint64]interface{}, error)

type ItfType

type ItfType interface {
	ByMapStr() MapStrItf
	ByMapInt() MapIntItf
	ByMapInt32() MapInt32Itf
	ByMapInt64() MapInt64Itf
	ByMapUint() MapUintItf
	ByMapUint32() MapUint32Itf
	ByMapUint64() MapUint64Itf
	ByMapFloat32() MapFloat32Itf
	ByMapFloat64() MapFloat64Itf
	ByMapItfToItf() MapInterfaceToItf
	ByList() MapListItf
}

func NewItfTypeImpl

func NewItfTypeImpl(itf interface{}) ItfType

func NewItfTypeImplErr

func NewItfTypeImplErr(itf interface{}, err *itferr.MapItfError) ItfType

type ItfTypeImpl

type ItfTypeImpl struct {
	Itf interface{}

	Err *itferr.MapItfError
}

func (*ItfTypeImpl) ByList

func (i *ItfTypeImpl) ByList() MapListItf

func (*ItfTypeImpl) ByMapFloat32

func (i *ItfTypeImpl) ByMapFloat32() MapFloat32Itf

func (*ItfTypeImpl) ByMapFloat64

func (i *ItfTypeImpl) ByMapFloat64() MapFloat64Itf

func (*ItfTypeImpl) ByMapInt

func (i *ItfTypeImpl) ByMapInt() MapIntItf

func (*ItfTypeImpl) ByMapInt32

func (i *ItfTypeImpl) ByMapInt32() MapInt32Itf

func (*ItfTypeImpl) ByMapInt64

func (i *ItfTypeImpl) ByMapInt64() MapInt64Itf

func (*ItfTypeImpl) ByMapItfToItf

func (i *ItfTypeImpl) ByMapItfToItf() MapInterfaceToItf

func (*ItfTypeImpl) ByMapStr

func (i *ItfTypeImpl) ByMapStr() MapStrItf

func (*ItfTypeImpl) ByMapUint

func (i *ItfTypeImpl) ByMapUint() MapUintItf

func (*ItfTypeImpl) ByMapUint32

func (i *ItfTypeImpl) ByMapUint32() MapUint32Itf

func (*ItfTypeImpl) ByMapUint64

func (i *ItfTypeImpl) ByMapUint64() MapUint64Itf

type MapFloat32Itf

type MapFloat32Itf interface {
	api.MapInterface

	WithErr(err *itferr.MapItfError) MapFloat32Itf
}

func NewMapFloat32ItfImpl

func NewMapFloat32ItfImpl(m interface{}) MapFloat32Itf

type MapFloat32ItfImpl

type MapFloat32ItfImpl struct {
	BaseItfImpl

	OriginMap map[float32]interface{}
}

func (*MapFloat32ItfImpl) Get

func (m *MapFloat32ItfImpl) Get(key interface{}) api.MapInterface

func (*MapFloat32ItfImpl) GetAny

func (m *MapFloat32ItfImpl) GetAny(keys ...interface{}) api.MapInterface

func (*MapFloat32ItfImpl) WithErr

type MapFloat64Itf

type MapFloat64Itf interface {
	api.MapInterface

	WithErr(err *itferr.MapItfError) MapFloat64Itf
}

func NewMapFloat64ItfImpl

func NewMapFloat64ItfImpl(m interface{}) MapFloat64Itf

type MapFloat64ItfImpl

type MapFloat64ItfImpl struct {
	BaseItfImpl

	OriginMap map[float64]interface{}
}

func (*MapFloat64ItfImpl) Get

func (m *MapFloat64ItfImpl) Get(key interface{}) api.MapInterface

func (*MapFloat64ItfImpl) GetAny

func (m *MapFloat64ItfImpl) GetAny(keys ...interface{}) api.MapInterface

func (*MapFloat64ItfImpl) WithErr

type MapInt32Itf

type MapInt32Itf interface {
	api.MapInterface

	WithErr(err *itferr.MapItfError) MapInt32Itf
}

func NewMapInt32ItfImpl

func NewMapInt32ItfImpl(m interface{}) MapInt32Itf

type MapInt32ItfImpl

type MapInt32ItfImpl struct {
	BaseItfImpl

	OriginMap map[int32]interface{}
}

func (*MapInt32ItfImpl) Get

func (m *MapInt32ItfImpl) Get(key interface{}) api.MapInterface

func (*MapInt32ItfImpl) GetAny

func (m *MapInt32ItfImpl) GetAny(keys ...interface{}) api.MapInterface

func (*MapInt32ItfImpl) WithErr

func (m *MapInt32ItfImpl) WithErr(err *itferr.MapItfError) MapInt32Itf

type MapInt64Itf

type MapInt64Itf interface {
	api.MapInterface

	WithErr(err *itferr.MapItfError) MapInt64Itf
}

func NewMapInt64ItfImpl

func NewMapInt64ItfImpl(m interface{}) MapInt64Itf

type MapInt64ItfImpl

type MapInt64ItfImpl struct {
	BaseItfImpl

	OriginMap map[int64]interface{}
}

func (*MapInt64ItfImpl) Get

func (m *MapInt64ItfImpl) Get(key interface{}) api.MapInterface

func (*MapInt64ItfImpl) GetAny

func (m *MapInt64ItfImpl) GetAny(keys ...interface{}) api.MapInterface

func (*MapInt64ItfImpl) WithErr

func (m *MapInt64ItfImpl) WithErr(err *itferr.MapItfError) MapInt64Itf

type MapIntItf

type MapIntItf interface {
	api.MapInterface

	WithErr(err *itferr.MapItfError) MapIntItf
}

func NewMapIntItfImpl

func NewMapIntItfImpl(m interface{}) MapIntItf

type MapIntItfImpl

type MapIntItfImpl struct {
	BaseItfImpl

	OriginMap map[int]interface{}
}

func (*MapIntItfImpl) Get

func (m *MapIntItfImpl) Get(key interface{}) api.MapInterface

func (*MapIntItfImpl) GetAny

func (m *MapIntItfImpl) GetAny(keys ...interface{}) api.MapInterface

func (*MapIntItfImpl) WithErr

func (m *MapIntItfImpl) WithErr(err *itferr.MapItfError) MapIntItf

type MapInterfaceToItf

type MapInterfaceToItf interface {
	api.MapInterface

	WithErr(err *itferr.MapItfError) MapInterfaceToItf
}

func NewMapInterfaceToItfImpl

func NewMapInterfaceToItfImpl(m interface{}) MapInterfaceToItf

type MapInterfaceToItfImpl

type MapInterfaceToItfImpl struct {
	BaseItfImpl

	OriginMap map[interface{}]interface{}
}

func (*MapInterfaceToItfImpl) Get

func (m *MapInterfaceToItfImpl) Get(key interface{}) api.MapInterface

func (*MapInterfaceToItfImpl) GetAny

func (m *MapInterfaceToItfImpl) GetAny(keys ...interface{}) api.MapInterface

func (*MapInterfaceToItfImpl) WithErr

type MapListItf

type MapListItf interface {
	api.MapInterface
}

func NewBasicItfImpl

func NewBasicItfImpl(m interface{}) MapListItf

func NewBasicListItfImpl

func NewBasicListItfImpl(m interface{}) MapListItf

func NewMapListItfImpl

func NewMapListItfImpl(m interface{}) MapListItf

type MapListItfImpl

type MapListItfImpl struct {
	BaseItfImpl

	OriginListItf []interface{}
}

func (*MapListItfImpl) Index

func (m *MapListItfImpl) Index(index int) api.MapInterface

type MapStrItf

type MapStrItf interface {
	api.MapInterface

	GetByPath(keys ...string) MapStrItf

	WithErr(err *itferr.MapItfError) MapStrItf
}

func NewMapStrItfImpl

func NewMapStrItfImpl(m interface{}) MapStrItf

type MapStrItfImpl

type MapStrItfImpl struct {
	BaseItfImpl

	OriginMap map[string]interface{}
}

MapStrItfImpl 典型实现,整个通过接口交互,对外封闭,对内开放

func (*MapStrItfImpl) Get

func (m *MapStrItfImpl) Get(key interface{}) api.MapInterface

func (*MapStrItfImpl) GetAny

func (m *MapStrItfImpl) GetAny(keys ...interface{}) api.MapInterface

func (*MapStrItfImpl) GetByPath

func (m *MapStrItfImpl) GetByPath(keys ...string) MapStrItf

Get 类似于py中json_obj[key1][key2][[key3] 或 json_obj.get(key1, {}).get(key2, [])

func (*MapStrItfImpl) WithErr

func (m *MapStrItfImpl) WithErr(err *itferr.MapItfError) MapStrItf

type MapUint32Itf

type MapUint32Itf interface {
	api.MapInterface

	WithErr(err *itferr.MapItfError) MapUint32Itf
}

func NewMapUint32ItfImpl

func NewMapUint32ItfImpl(m interface{}) MapUint32Itf

type MapUint32ItfImpl

type MapUint32ItfImpl struct {
	BaseItfImpl

	OriginMap map[uint32]interface{}
}

func (*MapUint32ItfImpl) Get

func (m *MapUint32ItfImpl) Get(key interface{}) api.MapInterface

func (*MapUint32ItfImpl) GetAny

func (m *MapUint32ItfImpl) GetAny(keys ...interface{}) api.MapInterface

func (*MapUint32ItfImpl) WithErr

type MapUint64Itf

type MapUint64Itf interface {
	api.MapInterface

	WithErr(err *itferr.MapItfError) MapUint64Itf
}

func NewMapUint64ItfImpl

func NewMapUint64ItfImpl(m interface{}) MapUint64Itf

type MapUint64ItfImpl

type MapUint64ItfImpl struct {
	BaseItfImpl

	OriginMap map[uint64]interface{}
}

func (*MapUint64ItfImpl) Get

func (m *MapUint64ItfImpl) Get(key interface{}) api.MapInterface

func (*MapUint64ItfImpl) GetAny

func (m *MapUint64ItfImpl) GetAny(keys ...interface{}) api.MapInterface

func (*MapUint64ItfImpl) WithErr

type MapUintItf

type MapUintItf interface {
	api.MapInterface

	WithErr(err *itferr.MapItfError) MapUintItf
}

func NewMapUintItfImpl

func NewMapUintItfImpl(m interface{}) MapUintItf

type MapUintItfImpl

type MapUintItfImpl struct {
	BaseItfImpl

	OriginMap map[uint]interface{}
}

func (*MapUintItfImpl) Get

func (m *MapUintItfImpl) Get(key interface{}) api.MapInterface

func (*MapUintItfImpl) GetAny

func (m *MapUintItfImpl) GetAny(keys ...interface{}) api.MapInterface

func (*MapUintItfImpl) WithErr

func (m *MapUintItfImpl) WithErr(err *itferr.MapItfError) MapUintItf

type OneLevelMapImpl

type OneLevelMapImpl struct {
	BaseItfImpl

	OriginMap interface{}
}

func NewOneLevelMap

func NewOneLevelMap(m interface{}) *OneLevelMapImpl

func (*OneLevelMapImpl) Get

func (o *OneLevelMapImpl) Get(key interface{}) api.MapInterface

func (*OneLevelMapImpl) GetAny

func (o *OneLevelMapImpl) GetAny(keys ...interface{}) api.MapInterface

type OneLevelMapItf

type OneLevelMapItf interface {
	api.MapInterface
}

Jump to

Keyboard shortcuts

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