Documentation ¶
Index ¶
- Variables
- func CheckAuthByUserId(c *gin.Context, userId string) (isAuth bool)
- func CreateApp() *gin.Engine
- func CreateSafeFilePath(dirNames []string, fileName string) string
- func CreateToken(uid string, password string) (string, error)
- func GetConfig() config
- func GetCurrentUserId(c *gin.Context) (uid string)
- func GetExecDirPath() string
- func If[T any](is bool, v1 T, v2 T) T
- func MergeJson(args ...any) (map[string]any, error)
- func ParseToken(tokenStr string) (*claims, int)
- func ToAbsPath(filePath string) string
- func ToClaims(data any) (res *claims, isOk bool)
- func ToHashFileName(fileName string) (hashFileName string)
- func UUID() string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ConfigFilePath = ToAbsPath("../config/config.toml") CertFilePath = ToAbsPath("../config/tls.pem") // create your tls.pem KeyFilePath = ToAbsPath("../config/tls.key") // create your tls.key StaticAssetsPath = ToAbsPath("../assets") LogDirPath = ToAbsPath("../logs") )
View Source
var Db *gorm.DB
View Source
var DbErr error
View Source
var Logger *logrus.Logger
Functions ¶
func CheckAuthByUserId ¶
CheckAuthByUserId 通过userId判断当前有无权限
func CreateSafeFilePath ¶
CreateSafeFilePath 创建安全的文件路径
func CreateToken ¶
CreateToken 生成token
func GetCurrentUserId ¶
GetCurrentUserId 获取当前登陆的userId
func ToHashFileName ¶
ToHashFileName 转唯一文件名
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.