simpleioc

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[T any](bean T) T

Get 从容器中获取与方法参数类型一致的指针-struct对象

func Get2

func Get2(key string) interface{}

func GetCache

func GetCache() cache.Rediser

GetCache 获取redis实例

func GetCronJobInstance

func GetCronJobInstance() *cron.Cron

GetCronJobInstance 获取定时任务实例

func GetDb

func GetDb() *gorm.DB

GetDb 获取数据库实例

func GetMongoDb

func GetMongoDb() *mongodb.Client

GetMongoDb 获取MongoDbClient

func Set

func Set(beans ...any)

Set 将struct类型对象放入容器中,只能传入指针-struct类型数据

func Set2

func Set2(key string, bean any) (err error)

Types

type GlobalContext

type GlobalContext struct {
	Ctx context.Context
}

GlobalContext 封装全局存区容器

func GetContext

func GetContext() *GlobalContext

GetContext 获取全局上下文

Jump to

Keyboard shortcuts

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