momo

package module
v1.1.24 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

README

momo

介绍

go语言写的实用类库

使用说明

func main() { // 定义命令行参数 mode := flag.String("mode", "release", "运行模式:debug, release, test") acl := flag.Bool("acl", true, "是否启用访问控制:true,false") acs := flag.Bool("acs", true, "是否启用访问统计:true,false") port := flag.Int("port", 6001, "主程序运行端口") prome := flag.Int("prome_port", 6011, "prometheus运行端口") static := flag.String("static", "admin", "静态目录") flag.Parse()

// 初始化基本路由
r := momo.NewRouterBuilder().WithMode(*mode).WithAcl(*acl).WithAcs(*acs).WithPromePort(*prome).WithLog(true).Build()
r.Static("/view", "view")
r.Static("/admin", *static)
fmt.Printf(" - using static:  %v\n", *static)
fmt.Printf(" - using port:  %v\n", *port)

// 注册自定义路由分组
// genAdapter := igin.NewGinRouterAdapter(r.Engine).Group("/api/gen")
// genCtl.DataSourceRouter(genAdapter)
r.Run(fmt.Sprintf("0.0.0.0:%d", *port))

// 自定义rbac数据库
// db := dao.RbacDb
// db := rbacService.RbacDb
// userRepo := rbac.NewGormUserRepo(db, &model.UserEntity{})
// roleRepo := rbac.NewGormRoleRepo(db, &model.RoleEntity{})
// permitRepo := rbac.NewGormPermitRepo(db, &model.MenuEntity{})
// rb.config.Service = rbac.NewRBACService(userRepo, roleRepo, permitRepo, rb.config.SecretKey)

}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRouter added in v1.1.24

func BuildRouter(engine *igin.Engine, config *globalConf) *igin.Engine

func ConfRouter added in v1.0.2

func ConfRouter(engine *igin.Engine, group string)

func GenRouter added in v1.0.2

func GenRouter(engine *igin.Engine, group string)

func GetGlobalConf added in v1.1.24

func GetGlobalConf() globalConf

func JobRouter added in v1.0.2

func JobRouter(router *igin.Engine, group string)

func LogRouter added in v1.0.2

func LogRouter(engine *igin.Engine, group string)

func NewConfig added in v1.1.24

func NewConfig() *globalConf

NewConfig 创建并返回一个新的Config实例

func RbacRouter added in v1.0.2

func RbacRouter(engine *igin.Engine, group string)

func RegisterMaxRoutes added in v1.1.24

func RegisterMaxRoutes(engine *igin.Engine)

RegisterRoutes 注册路由

func RegisterMiddlewares added in v1.1.24

func RegisterMiddlewares(engine *igin.Engine, config *globalConf)

RegisterMiddlewares 注册中间件

func SrvRouter added in v1.0.2

func SrvRouter(engine *igin.Engine, group string)

func Start added in v1.1.24

func Start(engine *igin.Engine, config *globalConf)

Types

This section is empty.

Directories

Path Synopsis
app
rbac/captcha/assets/bindata/images
Code generated for package images by go-bindata DO NOT EDIT.
Code generated for package images by go-bindata DO NOT EDIT.
rbac/captcha/assets/bindata/tiles
Code generated for package tiles by go-bindata DO NOT EDIT.
Code generated for package tiles by go-bindata DO NOT EDIT.
controllers/base_controller.go
controllers/base_controller.go
service/base_service.go
service/base_service.go
collector
Package collector includes all individual collectors to gather and export system metrics.
Package collector includes all individual collectors to gather and export system metrics.

Jump to

Keyboard shortcuts

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