common

package
v0.5.17 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: GPL-3.0 Imports: 28 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CasbinEnforcer *casbin.Enforcer

全局CasbinEnforcer

View Source
var DB *gorm.DB

全局数据库对象

全局日志变量 var Log *zap.Logger

全局翻译器

View Source
var Validate *validator.Validate

全局Validate数据校验实列

Functions

func ConnMysql added in v0.5.6

func ConnMysql() *gorm.DB

func ConnSqlite added in v0.5.6

func ConnSqlite() *gorm.DB

func GetLDAPConn added in v0.5.2

func GetLDAPConn() (*ldap.Conn, error)

GetLDAPConn 获取 LDAP 连接

func InitCasbinEnforcer

func InitCasbinEnforcer()

初始化casbin策略管理器

func InitDB added in v0.5.4

func InitDB()

初始化数据库

func InitData

func InitData()

初始化mysql数据

func InitLDAP

func InitLDAP()

Init 初始化连接

func InitLogger

func InitLogger()

*

  • 初始化日志
  • filename 日志文件路径
  • level 日志级别
  • maxSize 每个日志文件保存的最大尺寸 单位:M
  • maxBackups 日志文件最多保存多少个备份
  • maxAge 文件最多保存多少天
  • compress 是否压缩
  • serviceName 服务名
  • 由于zap不具备日志切割功能, 这里使用lumberjack配合

func InitValidate

func InitValidate()

初始化Validator数据校验

func PutLADPConn added in v0.5.2

func PutLADPConn(conn *ldap.Conn)

PutLDAPConn 放回 LDAP 连接

Types

type LdapConnPool added in v0.5.2

type LdapConnPool struct {
	// contains filtered or unexported fields
}

func (*LdapConnPool) GetConnection added in v0.5.2

func (lcp *LdapConnPool) GetConnection() (*ldap.Conn, error)

获取一个 ladp Conn

func (*LdapConnPool) PutConnection added in v0.5.2

func (lcp *LdapConnPool) PutConnection(conn *ldap.Conn)

Jump to

Keyboard shortcuts

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