container

package
v1.0.1006 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallFunc

func CallFunc(fn any, params []any) ([]any, error)

执行函数

func CallMethod

func CallMethod(in any, method string, params []any) ([]any, error)

执行结构体方法

func MethodExists

func MethodExists(in any, method string) bool

判断结构体方法是否存在

Types

type Callable

type Callable struct {
	Error error
	// contains filtered or unexported fields
}

*

  • 调用容器 *
  • @create 2022-8-3
  • @author deatil

func NewCallable

func NewCallable(fn any) Callable

构造函数

func (Callable) Arguments

func (this Callable) Arguments() []reflect.Type

传入参数

func (Callable) Call

func (this Callable) Call(in []reflect.Value) []reflect.Value

调用

func (Callable) FnCall

func (this Callable) FnCall(params []any) []any

调用方法

func (Callable) InNum

func (this Callable) InNum() int

输入数量

func (Callable) OutNum

func (this Callable) OutNum() int

输出数量

func (Callable) Parse

func (this Callable) Parse(fn any) Callable

解析

func (Callable) Returns

func (this Callable) Returns() []reflect.Type

返回数据

type Container

type Container struct {
	// sync 数据
	SyncMap sync.Map
}

*

  • 容器结构体 *
  • @create 2021-6-19
  • @author deatil

func Instance

func Instance() *Container

单例

func New

func New() *Container

构造函数

func (*Container) Delete

func (this *Container) Delete(key string) bool

删除

func (*Container) Exists

func (this *Container) Exists(key string) bool

判断是否存在

func (*Container) FuzzyDelete

func (this *Container) FuzzyDelete(keyPre string)

按照键的前缀删除容器中注册的内容

func (*Container) Get

func (this *Container) Get(key string) any

取值

func (*Container) Set

func (this *Container) Set(key string, value any) bool

键值对的形式将代码注册到容器

func (*Container) SetItems

func (this *Container) SetItems(key string, value any) bool

*

  • 单值批量设置

Jump to

Keyboard shortcuts

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