app

package
v7.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: MIT Imports: 40 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 InitCaptcha

func InitCaptcha()

InitCaptcha 初始化图形验证码

func InitCasbin

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

InitCasbin 初始化casbin

func InitGinEngine

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

InitGinEngine 初始化gin引擎

func InitGormDB

func InitGormDB() (*gorm.DB, func(), error)

InitGormDB 初始化gorm存储

func InitHTTPServer

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

InitHTTPServer 初始化http服务

func InitLogger

func InitLogger() (func(), error)

InitLogger 初始化日志模块

func InitMonitor

func InitMonitor(ctx context.Context) func()

InitMonitor 初始化服务监控

func NewGormDB

func NewGormDB() (*gorm.DB, func(), error)

NewGormDB 创建DB实例

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
	MenuBll        *bll.Menu
}

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

func BuildInjector

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

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
api
model
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