di

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: Zlib Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Container

func Container() *dig.Container

func Initialize added in v0.8.18

func Initialize()

func Invoke

func Invoke(function interface{}, opts ...dig.InvokeOption) error

func MustGet added in v0.8.16

func MustGet[T any]() T

func MustInvoke added in v0.8.16

func MustInvoke(function interface{}, opts ...dig.InvokeOption)

func MustProvide added in v0.8.16

func MustProvide(constructor interface{}, opts ...dig.ProvideOption)

func MustProvides added in v0.8.16

func MustProvides(constructors ...interface{})

func Provide added in v0.8.16

func Provide(constructor interface{}, opts ...dig.ProvideOption) error

func ProvideConfig

func ProvideConfig()

func ProvideDatabase

func ProvideDatabase()

func ProvideHTTP added in v0.9.6

func ProvideHTTP()

func ProvideLogger

func ProvideLogger()

func ProvideRedis

func ProvideRedis()

func ProvideSession added in v0.8.21

func ProvideSession()

func ProvideTracer

func ProvideTracer()

Types

type Apollo

type Apollo = *pkg.ApolloPkg

type Config

type Config = *pkg.ConfigPkg

type ConfigConf added in v0.8.17

type ConfigConf struct {
	ConfigPath       string               `mapstructure:"config_path"`
	ConfigType       string               `mapstructure:"config_type"`
	ApolloConf       string               `mapstructure:"apollo_conf"`
	ApUpdateCallback pkg.ApUpdateCallback `mapstructure:"ap_update_callback"`
	InitCallback     func()               `mapstructure:"init_callback"`
}

ConfigConf 基础本地初始化配置

type Database

type Database = *pkg.DatabasePkg

type DatabaseConf added in v0.8.17

type DatabaseConf struct {
	DBKey    string         `mapstructure:"db_key"`
	CallBack func(*gorm.DB) `mapstructure:"call_back"`
}

DatabaseConf 数据库初始化配置

type HTTP added in v0.9.6

type HTTP = func() *pkg.HTTPPkg

type Logger

type Logger = *pkg.LoggerPkg

type LoggerConf added in v0.8.17

type LoggerConf struct {
	LogDir     string         `mapstructure:"log_dir"`      // 日志目录
	PreLogFunc pkg.PreLogFunc `mapstructure:"pre_log_func"` // 日志记录前的前置处理方法
	Log2Tracer bool           `mapstructure:"log_2_tracer"` // 是否同时把日志记录到链路跟踪
}

LoggerConf 日志初始化配置

type Redis

type Redis = *pkg.Redis

type RedisConf added in v0.8.17

type RedisConf struct {
	Host      string `mapstructure:"host"`
	Port      int    `mapstructure:"port"`
	Password  string `mapstructure:"password"`
	PoolSize  int    `mapstructure:"pool_size"`
	DefaultDB int    `mapstructure:"default_db"`
	Prefix    string `mapstructure:"prefix"`
}

RedisConf redis缓存初始化配置

type Routes added in v0.8.20

type Routes = pkg.Routes

type Rule added in v0.8.20

type Rule = pkg.Rule

type Session added in v0.8.21

type Session = pkg.Session

type SessionConf added in v0.8.21

type SessionConf struct {
	Prefix       string `mapstructure:"prefix"`
	CookieName   string `mapstructure:"cookie_name"`
	CookieDomain string `mapstructure:"cookie_domain"`
	Secure       bool   `mapstructure:"secure"`
	HTTPOnly     bool   `mapstructure:"http_only"`
}

SessionConf LoggerConf 日志初始化配置

type Tracer

type Tracer = *pkg.TracerPkg

type TracerConf added in v0.8.17

type TracerConf struct {
	Enable          bool   `mapstructure:"enable"`
	Host            string `mapstructure:"host"`
	Port            int    `mapstructure:"port"`
	MainServiceName string `mapstructure:"main_service_name"`
}

TracerConf 链路跟踪初始化配置

type Validators added in v0.8.20

type Validators = pkg.Validators

Jump to

Keyboard shortcuts

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