app

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: MIT Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InjectorSet = wire.NewSet(wire.Struct(new(Injector), "*"))

InjectorSet 注入Injector

Functions

func Init

func Init(ctx context.Context, opts ...Option) (func(), error)

Init 应用初始化

func InitAuth

func InitAuth() (auth.Auther, func(), error)

InitAuth 初始化用户认证

func InitCasbin

func InitCasbin(adapter persist.Adapter) (*casbin.SyncedEnforcer, func(), error)

InitCasbin 初始化casbin

func InitEntClient added in v1.0.6

func InitEntClient() (*ent.Client, func(), error)

InitGormDB 初始化gorm存储

func InitGinEngine

func InitGinEngine(r router.IRouter) *gin.Engine

InitGinEngine 初始化gin引擎

func InitHTTPServer

func InitHTTPServer(ctx context.Context, handler http.Handler) func()

InitHTTPServer 初始化http服务

func InitInfluxDB added in v1.0.6

func InitInfluxDB() (influxdb2.Client, func(), error)

func InitLogger

func InitLogger() (func(), error)

InitLogger 初始化日志模块

func InitMonitor

func InitMonitor(ctx context.Context) func()

InitMonitor 初始化服务监控

func InitRabbitMQ added in v1.0.6

func InitRabbitMQ() (*amqp.Connection, func(), error)

func InitRedisCli added in v1.0.2

func InitRedisCli() (redis.Cmdable, func(), error)

func InitVcode added in v1.0.2

func InitVcode(cli redis.Cmdable) *vcode.Vcode

func NewEntClient added in v1.0.6

func NewEntClient() (*ent.Client, func(), error)

NewGormDB 创建DB实例

func NewRedisCli added in v1.0.2

func NewRedisCli() (redis.Cmdable, func(), error)

func Run

func Run(ctx context.Context, opts ...Option) error

Run 运行服务

Types

type Injector

type Injector struct {
	Engine         *gin.Engine
	Auth           auth.Auther
	CasbinEnforcer *casbin.SyncedEnforcer
	MenuSrv        *service.Menu
	RedisCli       redis.Cmdable
}

Injector 注入器(用于初始化完成之后的引用)

func BuildInjector

func BuildInjector() (*Injector, func(), error)

BuildInjector 生成注入器

type Option

type Option func(*options)

Option 定义配置项

func SetConfigFile

func SetConfigFile(s string) Option

SetConfigFile 设定配置文件

func SetMenuFile

func SetMenuFile(s string) Option

SetMenuFile 设定菜单数据文件

func SetModelFile

func SetModelFile(s string) Option

SetModelFile 设定casbin模型配置文件

func SetVersion

func SetVersion(s string) Option

SetVersion 设定版本号

func SetWWWDir

func SetWWWDir(s string) Option

SetWWWDir 设定静态站点目录

Directories

Path Synopsis
module
Package test 接口测试 使用方式: go test -v
Package test 接口测试 使用方式: go test -v

Jump to

Keyboard shortcuts

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