MCPcopy Create free account

hub / github.com/aa12gq/goxenith / functions

Functions337 in github.com/aa12gq/goxenith

↓ 51 callersFunctionEnv
Env 读取环境变量,支持默认值
pkg/config/config.go:70
↓ 35 callersFunctionJSON
JSON 响应 200 和 JSON 数据
pkg/response/response.go:11
↓ 34 callersFunctionAbort500
Abort500 响应 500,未传参 msg 时使用默认消息
pkg/response/response.go:69
↓ 34 callersFunctionLogWarnIf
LogWarnIf 当 err != nil 时记录 warning 等级的日志
pkg/logger/logger.go:131
↓ 32 callersMethodAnnotations
()
app/models/schema/comment.go:16
↓ 31 callersFunctionGetString
GetString 获取 String 类型的配置信息
pkg/config/config.go:101
↓ 24 callersFunctionGet
Get 获取配置项 第一个参数 path 允许使用点式获取,如:app.name 第二个参数允许传参默认值
pkg/config/config.go:85
↓ 24 callersMethodGet
获取验证码
pkg/verifycode/store_interface.go:8
↓ 17 callersFunctionErrorString
(moduleName, name, msg string)
pkg/logger/logger.go:187
↓ 16 callersFunctionGet
(key string)
pkg/cache/cache.go:33
↓ 16 callersFunctionGetInt
GetInt 获取 Int 类型的配置信息
pkg/config/config.go:106
↓ 14 callersFunctionAbort404
Abort404 响应 404,未传参 msg 时使用默认消息
pkg/response/response.go:48
↓ 14 callersFunctionAuthJWT
()
app/http/middlewares/auth_jwt.go:14
↓ 14 callersFunctionBadRequest
BadRequest 响应 400,传参 err 对象,未传参 msg 时使用默认消息 在解析用户请求,请求的格式或者方法不符合预期时调用
pkg/response/response.go:77
↓ 14 callersMethodSet
保存验证码
pkg/verifycode/store_interface.go:5
↓ 12 callersFunctionvalidate
(data interface{}, rules govalidator.MapData, messages govalidator.MapData)
app/requests/requests.go:37
↓ 11 callersFunctionAbort400
Abort400 响应 400,记录已存在
pkg/response/response.go:62
↓ 11 callersFunctionLogIf
LogIf 当 err != nil 时记录 error 等级的日志
pkg/logger/logger.go:124
↓ 11 callersFunctionValidate
Validate 控制器里调用示例: if ok := requests.Validate(c, &requests.UserSaveRequest{}, requests.UserSave); !ok { return }
app/requests/requests.go:17
↓ 10 callersFunctionAdd
Add 新增配置项
pkg/config/config.go:78
↓ 10 callersFunctionCurrentUser
CurrentUser 从 gin.context 中获取当前登录用户
pkg/auth/auth.go:11
↓ 9 callersFunctionAbort403
Abort403 响应 403,未传参 msg 时使用默认消息
pkg/response/response.go:55
↓ 8 callersMethodCreate
(ctx context.Context, opts ...schema.MigrateOption)
pkg/model/ent_schema.go:12
↓ 8 callersFunctionError
Error 响应 404 或 422,未传参 msg 时使用默认消息 处理请求时出现错误 err,会附带返回 error 信息,如登录错误、找不到 ID 对应的 Model
pkg/response/response.go:87
↓ 8 callersFunctioninternalGet
(path string, defaultValue ...interface{})
pkg/config/config.go:89
↓ 7 callersFunctionGetInt64
GetInt64 获取 Int64 类型的配置信息
pkg/config/config.go:116
↓ 7 callersFunctionNewJWT
()
pkg/auth/jwt.go:54
↓ 7 callersFunctionSuccess
Success 响应 200 和预设『操作成功!』的 JSON 数据 执行某个『没有具体返回数据』的『变更』操作成功后调用,例如删除、修改密码、修改手机号
pkg/response/response.go:17
↓ 7 callersFunctiondefaultMessage
defaultMessage 内用的辅助函数,用以支持默认参数默认值 Go 不支持参数默认值,只能使用多变参数来实现类似效果
pkg/response/response.go:130
↓ 6 callersFunctionDebugJSON
DebugJSON 记录对象类型的 debug 日志,使用 json.Marshal 进行编码。调用示例: logger.DebugJSON("Auth", "读取登录用户", auth.CurrentUser())
pkg/logger/logger.go:198
↓ 6 callersFunctionError
Error 错误时记录,不应该中断程序,查看日志时重点关注
pkg/logger/logger.go:163
↓ 6 callersFunctionExit
Exit 打印一条报错消息,并退出 os.Exit(1)
pkg/console/console.go:26
↓ 6 callersFunctionjsonString
(value interface{})
pkg/logger/logger.go:218
↓ 5 callersMethodAnnotations
()
app/models/schema/like_record.go:23
↓ 5 callersFunctionIsLocal
()
pkg/app/app.go:8
↓ 5 callersFunctionLimitPerRoute
LimitPerRoute 限流中间件,用在单独的路由中
app/http/middlewares/limit.go:37
↓ 5 callersMethodSend
检查验证码
pkg/mail/driver_interface.go:5
↓ 5 callersFunctionSuccess
Success 打印一条成功消息,绿色输出
pkg/console/console.go:11
↓ 4 callersFunctionGuestJWT
GuestJWT 强制使用游客身份访问
app/http/middlewares/guest_jwt.go:10
↓ 4 callersFunctionIsProduction
()
pkg/app/app.go:12
↓ 4 callersMethodIssueToken
IssueToken 生成 Token,在登录成功时调用
pkg/auth/jwt.go:131
↓ 4 callersFunctionTimenowInTimezone
TimenowInTimezone 获取当前时间,支持时区
pkg/app/app.go:21
↓ 4 callersFunctionUnauthorized
Unauthorized 响应 401,未传参 msg 时使用默认消息 登录失败、jwt 解析失败时调用
pkg/response/response.go:122
↓ 3 callersFunctionBcryptPassword
BcryptPassword 使用 bcrypt 对密码进行加密 随机盐值和多次迭代来增强密码的安全性。
pkg/password/password.go:15
↓ 3 callersMethodDel
Del 删除存储在 redis 里的数据,支持多个 key 传参
pkg/redis/redis.go:93
↓ 3 callersFunctionEmpty
Empty 类似于 PHP 的 empty() 函数
pkg/helpers/helpers.go:13
↓ 3 callersMethodFields
Fields of the LikeRecord.
app/models/schema/like_record.go:40
↓ 3 callersFunctionForget
(key string)
pkg/cache/cache.go:121
↓ 3 callersFunctionNewCaptcha
NewCaptcha 单例模式获取
pkg/captcha/captcha.go:22
↓ 3 callersFunctionNewVerifyCode
NewVerifyCode 单例模式获取
pkg/verifycode/verifycode.go:24
↓ 3 callersFunctionSet
(key string, obj interface{}, expireTime time.Duration)
pkg/cache/cache.go:27
↓ 3 callersFunctionValidatePasswordConfirm
ValidatePasswordConfirm 自定义规则,检查两次密码是否正确
app/requests/validators/custom_validators.go:9
↓ 3 callersFunctionValidateVerifyCode
ValidateVerifyCode 自定义规则,验证『手机/邮箱验证码』
app/requests/validators/custom_validators.go:17
↓ 3 callersFunctioncolorOut
colorOut 内部使用,设置高亮颜色
pkg/console/console.go:39
↓ 3 callersFunctionconvertArticle
(article *ent.Article, likes int)
app/http/controllers/api/v1/article_controller.go:557
↓ 3 callersFunctionconvertComment
(comment *ent.Comment)
app/http/controllers/api/v1/comment_controller.go:165
↓ 2 callersFunctionBcryptPasswordMatch
BcryptPasswordMatch 对比明文密码和数据库的哈希值
pkg/password/password.go:25
↓ 2 callersFunctionDebugString
DebugString 记录一条字符串类型的 debug 日志,调用示例: logger.DebugString("SMS", "短信内容", string(result.RawResponse))
pkg/logger/logger.go:175
↓ 2 callersMethodDecrement
Decrement 当参数只有 1 个时,为 key,减去 1。 当参数有 2 个时,第一个参数为 key ,第二个参数为要减去的值 int64 类型。
pkg/cache/store_interface.go:21
↓ 2 callersFunctionGetBool
GetBool 获取 Bool 类型的配置信息
pkg/config/config.go:126
↓ 2 callersFunctionGetStringMapString
GetStringMapString 获取结构数据
pkg/config/config.go:131
↓ 2 callersFunctionHas
(key string)
pkg/cache/cache.go:41
↓ 2 callersMethodHas
(key string)
pkg/cache/store_interface.go:8
↓ 2 callersMethodIncrement
Increment 当参数只有 1 个时,为 key,增加 1。 当参数有 2 个时,第一个参数为 key ,第二个参数为要增加的值 int64 类型。
pkg/cache/store_interface.go:17
↓ 2 callersFunctionInitConfig
InitConfig 初始化配置信息,完成对环境变量以及 config 信息的加载
pkg/config/config.go:35
↓ 2 callersFunctionIsTesting
()
pkg/app/app.go:16
↓ 2 callersFunctionLowerCamel
LowerCamel 转为 lowerCamelCase,如 TopicComment -> topicComment
pkg/str/str.go:29
↓ 2 callersFunctionNewClient
NewClient 创建一个新的 redis 连接
pkg/redis/redis.go:31
↓ 2 callersMethodParserToken
ParserToken 解析 Token,中间件中调用
pkg/auth/jwt.go:62
↓ 2 callersMethodPing
Ping 用以测试 redis 连接是否正常
pkg/redis/redis.go:54
↓ 2 callersFunctionSetupLogger
()
bootstrap/logger.go:8
↓ 2 callersFunctionSnake
Snake 转为 snake_case,如 TopicComment -> topic_comment
pkg/str/str.go:19
↓ 2 callersMethodVerify
检查验证码
pkg/verifycode/store_interface.go:11
↓ 2 callersMethodVerifyCaptcha
VerifyCaptcha 验证验证码是否正确
pkg/captcha/captcha.go:55
↓ 2 callersFunctionWarn
Warn 警告类
pkg/logger/logger.go:158
↓ 2 callersFunctionconvertUserInfo
(user *ent.User)
app/http/controllers/api/v1/users_controller.go:237
↓ 2 callersFunctioncreateFileFromStub
(filePath string, stubName string, model Model, variables ...interface{})
app/cmd/make/make.go:50
↓ 2 callersMethodcreateToken
createToken 创建 Token,内部使用,外部请调用 IssueToken
pkg/auth/jwt.go:158
↓ 2 callersMethodexpireAtTime
expireAtTime 过期时间
pkg/auth/jwt.go:165
↓ 2 callersMethodgenerateVerifyCode
generateVerifyCode 生成验证码,并放置于 Redis 中
pkg/verifycode/verifycode.go:74
↓ 2 callersFunctiongetSummary
确保不会在中间的多字节字符上截断,并移除 Markdown 语法
app/http/controllers/api/v1/article_controller.go:64
↓ 2 callersMethodgetTokenFromHeader
getTokenFromHeader 使用 jwtpkg.ParseWithClaims 解析 Token Authorization:Bearer xxxxx
pkg/auth/jwt.go:188
↓ 2 callersFunctionlimitHandler
(c *gin.Context, key string, limit string)
app/http/middlewares/limit.go:55
↓ 2 callersFunctionmakeModelFromString
(name string)
app/cmd/make/make.go:39
↓ 2 callersMethodnameExists
(c *gin.Context, name string)
app/http/controllers/api/v1/auth/signup_controller.go:131
↓ 2 callersMethodparseTokenString
parseTokenString 使用 jwtpkg.ParseWithClaims 解析 Token
pkg/auth/jwt.go:180
↓ 1 callersMethodAnnotations
()
app/models/schema/category.go:24
↓ 1 callersMethodCheckAnswer
CheckAnswer 检查用户提交的验证码是否正确,key 可以是手机号或者 Email
pkg/verifycode/verifycode.go:59
↓ 1 callersFunctionCheckRate
CheckRate 检测请求是否超额
pkg/limiter/limiter.go:25
↓ 1 callersFunctionCobraCommandUsageTemplate
CobraCommandUsageTemplate Cobra 命令使用帮助模板
app/cmd/cmd.go:26
↓ 1 callersFunctionCobraHelpCommand
CobraHelpCommand 自定义的cobra帮助命令
app/cmd/cmd.go:65
↓ 1 callersFunctionConnectRedis
ConnectRedis 连接 redis 数据库,设置全局的 Redis 对象
pkg/redis/redis.go:24
↓ 1 callersFunctionCreatedJSON
CreatedJSON 响应 201 和 JSON 数据
pkg/response/response.go:43
↓ 1 callersFunctionCurrentUID
CurrentUID 从 gin.context 中获取当前登录用户 ID
pkg/auth/auth.go:21
↓ 1 callersFunctionData
Data 响应 200 和带 data 键的 JSON 数据 执行『更新操作』成功后调用,例如更新话题,成功后返回已更新的话题
pkg/response/response.go:26
↓ 1 callersFunctionDebug
Debug 调试日志,详尽的程序日志 调用示例: logger.Debug("Database", zap.String("sql", sql))
pkg/logger/logger.go:148
↓ 1 callersFunctionEntMigrateSchemas
(ctx context.Context, schemas []EntSchema, opts ...schema.MigrateOption)
pkg/model/ent_schema.go:16
↓ 1 callersFunctionError
Error 打印一条报错消息,红色输出
pkg/console/console.go:16
↓ 1 callersFunctionExists
Exists 判断文件是否存在
pkg/file/file.go:22
↓ 1 callersMethodFields
Fields of the Category.
app/models/schema/category.go:33
next →1–100 of 337, ranked by callers