g3

package module
v0.0.0-...-9a8be4e Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2022 License: MIT Imports: 12 Imported by: 0

README

g3

Documentation

Index

Constants

View Source
const (
	DefaultLogDir = "logs"
)

Variables

This section is empty.

Functions

func AppId

func AppId() string

func AppName

func AppName() string

func AppPath

func AppPath() string

AppPath app路径

func AssetPath

func AssetPath(filename string) string

func Boot

func Boot(cfg *Cfg)

Boot 初始化

func DefaultLevelEncoder

func DefaultLevelEncoder(l zapcore.Level, enc zapcore.PrimitiveArrayEncoder)

func DefaultTimeEncoder

func DefaultTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)

func EnsureAbs

func EnsureAbs(path string) string

EnsureAbs prepends the HomeDir to the given path if it is not an absolute path.

func HomeDir

func HomeDir() string

HomeDir 工作目录

func NewLogger

func NewLogger(name string, caller bool) *zap.Logger

func ZL

func ZL() *zap.Logger

Types

type Cfg

type Cfg struct {
	HomeDir string
	AppName string
	AppId   string
}

type Gin

type Gin struct {
	Engine *gin.Engine
	// contains filtered or unexported fields
}

func GetGin

func GetGin() *Gin

func SetGin

func SetGin(engine *gin.Engine) *Gin

func (*Gin) Group

func (g *Gin) Group(path string) *RGroup

func (*Gin) Html

func (g *Gin) Html(relativePath string, handlers ...gin.HandlerFunc)

type RGroup

type RGroup struct {
	Group *gin.RouterGroup
	// contains filtered or unexported fields
}

func (*RGroup) AddRolePerm

func (rg *RGroup) AddRolePerm(role string, perms ...string)

func (*RGroup) AddRouterPerms

func (rg *RGroup) AddRouterPerms(router string, perms ...string)

func (*RGroup) Bind

func (rg *RGroup) Bind(method, router string, handler gin.HandlerFunc, perms ...string)

func (*RGroup) ClearAllRolesPerm

func (rg *RGroup) ClearAllRolesPerm()

func (*RGroup) ClearRolePerm

func (rg *RGroup) ClearRolePerm(role string)

func (*RGroup) MakeOpen

func (rg *RGroup) MakeOpen(routers ...string)

func (*RGroup) MakeWhite

func (rg *RGroup) MakeWhite(routers ...string)

func (*RGroup) NewJwt

func (rg *RGroup) NewJwt(secret string, expires int64)

func (*RGroup) NewJwtToken

func (rg *RGroup) NewJwtToken(uid int64, roles string) (string, error)

func (*RGroup) Path

func (rg *RGroup) Path() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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