di

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigFromEnv

func GetConfigFromEnv() (*config, error)

func GetDiFromCtx

func GetDiFromCtx[T DI](ctx context.Context) T

func GetDiFromGin

func GetDiFromGin[T DI](c *gin.Context) T

func GinMiddleHandler

func GinMiddleHandler(di DI) gin.HandlerFunc

func GrpcStreamInterceptor

func GrpcStreamInterceptor(di DI) grpc.StreamServerInterceptor

func GrpcUnaryInterceptor

func GrpcUnaryInterceptor(di DI) grpc.UnaryServerInterceptor

func IniConfByEnv

func IniConfByEnv(path, env, fname string, di DI) error

初始化設定檔,讀YAML檔

func InitConf

func InitConf(path, fname string, di DI) error

func InitConfByByte

func InitConfByByte(b []byte, di DI) error

func InitConfByCfg

func InitConfByCfg(cfg *config, di DI) error

func InitConfByFile

func InitConfByFile(f string, di DI) error

func InitConfByUri

func InitConfByUri(uri string, di DI) error

func InitServiceDIByCfg

func InitServiceDIByCfg(cfg *config, di ServiceDI) error

func SetDiToCtx

func SetDiToCtx[T DI](ctx context.Context, di T) context.Context

func SetDiToGin

func SetDiToGin[T DI](c *gin.Context, di T)

Types

type CommonServiceDI

type CommonServiceDI struct {
	// contains filtered or unexported fields
}

func (*CommonServiceDI) GetService

func (s *CommonServiceDI) GetService() string

type DI

type DI interface {
	IsConfEmpty() error
	GetService() string
}

type ServiceDI

type ServiceDI interface {
	DI

	log.LoggerDI
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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