ioc

package
v0.0.0-...-a783adc Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CategoryProviders = wire.NewSet(handler.NewCategoryHandler, service.NewCategoryService, repository.NewCategoryRepository, dao.NewCategoryDao,
		wire.Bind(new(service.ICategoryService), new(*service.CategoryService)),
		wire.Bind(new(repository.ICategoryRepository), new(*repository.CategoryRepository)),
		wire.Bind(new(dao.ICategoryDao), new(*dao.CategoryDao)),
	)
	CommentProviders = wire.NewSet(handler2.NewCommentHandler, service2.NewCommentService, repository2.NewCommentRepository, dao2.NewCommentDao,
		wire.Bind(new(service2.ICommentService), new(*service2.CommentService)),
		wire.Bind(new(repository2.ICommentRepository), new(*repository2.CommentRepository)),
		wire.Bind(new(dao2.ICommentDao), new(*dao2.CommentDao)))
	ConfigProviders = wire.NewSet(handler3.NewConfigHandler, service3.NewConfigService, repository3.NewConfigRepository, dao3.NewConfigDao,
		wire.Bind(new(service3.IConfigService), new(*service3.ConfigService)),
		wire.Bind(new(repository3.IConfigRepository), new(*repository3.ConfigRepository)),
		wire.Bind(new(dao3.IConfigDao), new(*dao3.ConfigDao)))
	FriendProviders = wire.NewSet(handler4.NewFriendHandler, service4.NewFriendService, repository4.NewFriendRepository, dao4.NewFriendDao,
		wire.Bind(new(service4.IFriendService), new(*service4.FriendService)),
		wire.Bind(new(repository4.IFriendRepository), new(*repository4.FriendRepository)),
		wire.Bind(new(dao4.IFriendDao), new(*dao4.FriendDao)))
	PostProviders = wire.NewSet(handler5.NewPostHandler, service5.NewPostService, repository5.NewPostRepository, dao5.NewPostDao,
		wire.Bind(new(service5.IPostService), new(*service5.PostService)),
		wire.Bind(new(repository5.IPostRepository), new(*repository5.PostRepository)),
		wire.Bind(new(dao5.IPostDao), new(*dao5.PostDao)))
	VlProviders = wire.NewSet(handler6.NewVisitLogHandler, service6.NewVisitLogService, repository6.NewVisitLogRepository, dao6.NewVisitLogDao,
		wire.Bind(new(service6.IVisitLogService), new(*service6.VisitLogService)),
		wire.Bind(new(repository6.IVisitLogRepository), new(*repository6.VisitLogRepository)),
		wire.Bind(new(dao6.IVisitLogDao), new(*dao6.VisitLogDao)))

	EmailProviders = wire.NewSet(service7.NewEmailService, wire.Bind(new(service7.IEmailService), new(*service7.EmailService)))

	MsgProviders = wire.NewSet(service8.NewMessageService, wire.Bind(new(service8.IMessageService), new(*service8.MessageService)))

	MsgTplProviders = wire.NewSet(handler7.NewMsgTplHandler, service9.NewMsgTplService, repository7.NewMsgTplRepository, dao7.NewMsgTplDao,
		wire.Bind(new(service9.IMsgTplService), new(*service9.MsgTplService)),
		wire.Bind(new(repository7.IMsgTplRepository), new(*repository7.MsgTplRepository)),
		wire.Bind(new(dao7.IMsgTplDao), new(*dao7.MsgTplDao)))
)

Functions

func InitLogger

func InitLogger(cfg *Config) io.Writer

func InitMiddlewares

func InitMiddlewares(cfg *Config, writer io.Writer) []gin.HandlerFunc

func NewMongoDB

func NewMongoDB(cfg *Config) *mongo.Database

Types

type Config

type Config struct {
	System  SystemConfig  `json:"system" yaml:"system"`
	Gin     GinConfig     `json:"gin" yaml:"gin"`
	Logger  LoggerConfig  `json:"logger" yaml:"logger"`
	MongoDb MongodbConfig `json:"mongo_db" yaml:"mongo_db"`
}

func InitConfig

func InitConfig(cfgPath string) *Config

type GinConfig

type GinConfig struct {
	AllowedOrigins []string `json:"allowed_origins" yaml:"allowed_origins"`
	AllowedMethods []string `json:"allowed_methods" yaml:"allowed_methods"`
	AllowedHeaders []string `json:"allowed_headers" yaml:"allowed_headers"`
}

type LoggerConfig

type LoggerConfig struct {
	Filename   string `json:"file_name" yaml:"file_name"`
	MaxSize    int    `json:"max_size" yaml:"max_size"`
	MaxAge     int    `json:"max_age" yaml:"max_age"`
	MaxBackups int    `json:"max_backups" yaml:"max_backups"`
	LocalTime  bool   `json:"local_time" yaml:"local_time"`
	Compress   bool   `json:"compress" yaml:"compress"`
	Level      string `json:"level" yaml:"level"`
	TimeFormat string `json:"time_format" yaml:"time_format"`
}

type MongodbConfig

type MongodbConfig struct {
	Uri        string `json:"uri" yaml:"uri"`
	Username   string `json:"username" yaml:"username"`
	Password   string `json:"password" yaml:"password"`
	AuthSource string `json:"auth_source" yaml:"auth_source"`
	Database   string `json:"database" yaml:"database"`
}

type SystemConfig

type SystemConfig struct {
	StaticPath string `json:"static_path" yaml:"static_path"`
}

type Validators

type Validators map[string]func(fl validator.FieldLevel) bool

func InitGinValidators

func InitGinValidators() Validators

Jump to

Keyboard shortcuts

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