ioc

package
v0.0.0-...-d13da26 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Overview

Package ioc 依赖反转

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDB

func InitDB(l logger.LoggerV1) *gorm.DB

func InitJobs

func InitJobs(l logger.LoggerV1, rankingJob *job.RankingJob) *cron.Cron

func InitKafka

func InitKafka() sarama.Client

func InitLocalFuncExecutor

func InitLocalFuncExecutor(svc service.RankingService) *job.LocalFuncExecutor

func InitLogger

func InitLogger() logger.LoggerV1

func InitMiddlewares

func InitMiddlewares(redisClient redis.Cmdable,
	l logger2.LoggerV1,
	jwtHdl ijwt.Handler) []gin.HandlerFunc

func InitOTEL

func InitOTEL() func(ctx context.Context)

func InitRLockClient

func InitRLockClient(cmd redis.Cmdable) *rlock.Client

func InitRankingJob

func InitRankingJob(svc service.RankingService,
	rlockClient *rlock.Client,
	l logger.LoggerV1) *job.RankingJob

func InitRedis

func InitRedis() redis.Cmdable

func InitSMSService

func InitSMSService(cmd redis.Cmdable) sms.Service

func InitScheduler

func InitScheduler(l logger.LoggerV1,
	local *job.LocalFuncExecutor,
	svc service.JobService) *job.Scheduler

func InitUserCache

func InitUserCache(client *redis.ClusterClient) cache.UserCache

InitUserCache 配合 PrometheusHook 使用

func InitWebServer

func InitWebServer(mdls []gin.HandlerFunc, userHdl *web.UserHandler,
	oauth2WechatHdl *web.OAuth2WechatHandler, articleHdl *web.ArticleHandler) *gin.Engine

func InitWechatService

func InitWechatService(l logger2.LoggerV1) wechat.Service

func NewConsumers

NewConsumers 面临的问题依旧是所有的 Consumer 在这里注册一下

func NewSyncProducer

func NewSyncProducer(client sarama.Client) sarama.SyncProducer

Types

type Callbacks

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

func (*Callbacks) Initialize

func (pcb *Callbacks) Initialize(db *gorm.DB) error

func (*Callbacks) Name

func (pcb *Callbacks) Name() string

type Configer

type Configer interface {
	GetString(ctx context.Context, key string) (string, error)
	MustGetString(ctx context.Context, key string) string
	GetStringOrDefault(ctc context.Context, key string, def string) string
}

type DoSomething

type DoSomething interface {
	DoABC() string
}

type DoSomethingFunc

type DoSomethingFunc func() string

func (DoSomethingFunc) DoABC

func (d DoSomethingFunc) DoABC() string

type MyTracer

type MyTracer struct {
	Enable bool
	// contains filtered or unexported fields
}

func (*MyTracer) Start

func (m *MyTracer) Start(ctx context.Context, spanName string, opts ...trace2.SpanStartOption) (context.Context, trace2.Span)

type MyTracerProvider

type MyTracerProvider struct {
	// 改原子操作
	Enable bool
	// contains filtered or unexported fields
}

func (*MyTracerProvider) Tracer

func (m *MyTracerProvider) Tracer(name string, options ...trace2.TracerOption) trace2.Tracer

func (*MyTracerProvider) TracerV1

func (m *MyTracerProvider) TracerV1(name string, options ...trace2.TracerOption) trace2.Tracer

type ViperConfigerAdapter

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

Jump to

Keyboard shortcuts

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