abstract

package
v0.0.0-...-33c5ed1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IDValue

type IDValue struct {
	ID   string `json:"id"`
	Name string `json:"value"`
}

id和value

type IDValueArr

type IDValueArr []IDValue

type IDValueOther

type IDValueOther struct {
	ID    string         `json:"id"`
	Value string         `json:"value"`
	Other map[string]any `json:"other"`
}

带额外数据的id value

type IID

type IID interface {
	GeID() string
}

获取指定key的集合 一般获取id name等 注: 此接口一个结构生成的是固定的数组 需要支持多字段转数组的,可使用 IKeyValue

type IIDArr

type IIDArr[V IID] []V

注: 此接口一个结构生成的是固定的数组 需要支持多字段转数组的,可使用 IKeyArr

func (IIDArr[V]) Keys

func (arr IIDArr[V]) Keys() []string

func (IIDArr[V]) KeysUnique

func (arr IIDArr[V]) KeysUnique() []string

type IIDValue

type IIDValue interface {
	GetID() string
	GetName() string
}

type IIDValueArr

type IIDValueArr[V IIDValue] []V

func (IIDValueArr[V]) ToIDValueArr

func (arr IIDValueArr[V]) ToIDValueArr() IDValueArr

数组直接转为 IDValue 数组

type IKey

type IKey interface {
	GetValueByKey(keyName string) string
}

获取指定key的集合 一般获取id name等

type IKeyArr

type IKeyArr[V IKey] []V

注: 此接口一个结构生成的是固定的数组 需要支持多字段转数组的,可使用 IKeyArr

func (IKeyArr[V]) Keys

func (arr IKeyArr[V]) Keys(keyName string) []string

func (IKeyArr[V]) KeysUnique

func (arr IKeyArr[V]) KeysUnique(keyName string) []string

type ITree

type ITree interface {
	GetID() string
	GetParentID() string
	GetName() string //主要是用在label显示
}

type ITreeArr

type ITreeArr[V ITree] []V

func (ITreeArr[V]) ToTree

func (arr ITreeArr[V]) ToTree() []*TreeObject

只有一个根节点的

type TreeObject

type TreeObject struct {
	ID       string        `json:"id"`
	Name     string        `json:"name"`
	Node     ITree         `json:"node"`
	Children []*TreeObject `json:"children,omitempty"`
}

树结构对象

Jump to

Keyboard shortcuts

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