momo

package module
v1.1.52 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: GPL-3.0 Imports: 32 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 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 RegMaxRoutes added in v1.1.34

func RegMaxRoutes(engine *igin.Engine)

func RegMiddle added in v1.1.34

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

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

type GlobalConfDTO added in v1.1.27

type GlobalConfDTO struct {
	Version     string
	Mode        string
	Acl         bool
	Acs         bool
	Log         bool
	Port        int
	Cpu         int
	Host        string
	ServerAddr  string
	Static      string
	SystemdName string
	ExePath     string
	Prometheus  bool
	Throttle    bool
	Probe       bool
}

func GetGlobalConf added in v1.1.24

func GetGlobalConf() GlobalConfDTO

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.
schemas.go
schemas.go
ip

Jump to

Keyboard shortcuts

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