docs: add package and exported symbol comments for revive lint compliance

This commit is contained in:
ryan
2026-06-09 13:42:06 +08:00
parent 4ac9857fe8
commit b05d26c9c6
40 changed files with 87 additions and 0 deletions
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package auth_source 提供认证源管理功能
package auth_source
import (
@@ -27,6 +28,7 @@ import (
"github.com/gin-gonic/gin"
)
// AuthSourceRequest 创建或更新认证源的请求参数
type AuthSourceRequest struct {
Name string `json:"name"`
Type string `json:"type"`
@@ -39,6 +41,7 @@ type AuthSourceRequest struct {
IconURL string `json:"icon_url"`
}
// ToggleAuthSourceRequest 切换认证源启用状态的请求参数
type ToggleAuthSourceRequest struct {
IsActive bool `json:"is_active"`
}
+2
View File
@@ -15,8 +15,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package admin 提供管理后台功能
package admin
// 管理后台错误消息常量
const (
AdminRequired = "未经授权访问"
InvalidAuthSourceID = "认证源 ID 无效"
+1
View File
@@ -29,6 +29,7 @@ import (
"github.com/gin-gonic/gin"
)
// LoginAdminRequired 返回管理员权限校验中间件
func LoginAdminRequired() gin.HandlerFunc {
return func(c *gin.Context) {
// init trace
@@ -15,8 +15,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package system_config 提供系统配置管理功能
package system_config
// 系统配置错误消息常量
const (
SystemConfigNotFound = "系统配置不存在"
ConfigKeyRequired = "配置键不能为空"
+2
View File
@@ -15,8 +15,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package task 提供任务管理接口
package task
// 任务管理相关错误消息
const (
InvalidTaskType = "无效的任务类型"
InvalidTimeRange = "无效的时间范围"
+2
View File
@@ -14,8 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package template 提供模板管理功能
package template
// 模板管理相关错误消息
const (
TemplateNotFound = "模板不存在"
TemplateKeyRequired = "模板标识符不能为空"
+1
View File
@@ -15,6 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package user 提供用户管理功能
package user
const (
+1
View File
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package cap 提供人机验证中间件
package cap
const (
+1
View File
@@ -15,6 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package health 提供健康检查端点
package health
import (
+2
View File
@@ -15,6 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package oauth 提供 OAuth/OIDC 认证与会话管理
package oauth
import (
@@ -26,6 +27,7 @@ import (
"github.com/gin-gonic/gin"
)
// LogForAudit 将登录鉴权审计日志写入 Logger
func LogForAudit(ctx context.Context, user *model.User, c *gin.Context) {
auditLog := loginRequiredAuditLog{
UserID: user.ID,
+3
View File
@@ -22,6 +22,7 @@ import (
"time"
)
// Session 用户信息字段 Key
const (
UserNameKey = "username"
UserIDKey = "user_id"
@@ -32,11 +33,13 @@ const (
PendingOAuthEmailKey = "pending_oauth_email"
)
// OAuth State 缓存 Key 格式与过期时间
const (
OAuthStateCacheKeyFormat = "oauth:state:%s"
OAuthStateCacheKeyExpiration = 10 * time.Minute
)
// OAuth 授权用途常量
const (
OAuthPurposeLogin = "login"
OAuthPurposeBind = "bind"
+1
View File
@@ -17,6 +17,7 @@ limitations under the License.
package oauth
// OAuth 认证相关错误消息
const (
InvalidState = "非法登录请求"
IDTokenVerifyFailed = "ID Token 验证失败"
+1
View File
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package risk_control 提供风险控制中间件
package risk_control
import (
+2
View File
@@ -15,8 +15,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package upload 提供文件上传与下载功能
package upload
// 上传模块错误消息常量
const (
ErrNoFileSelected = "请选择要上传的文件"
ErrInvalidUploadType = "无效的上传类型"