25 lines
628 B
Go
25 lines
628 B
Go
package validator
|
|
|
|
import (
|
|
"cloudnest/internal/pkg/logger"
|
|
"github.com/go-playground/validator/v10"
|
|
)
|
|
|
|
// Validator is the global validator instance.
|
|
// Validator 是全局验证器实例。
|
|
var Validator *validator.Validate
|
|
|
|
// Init initializes the validator.
|
|
// Init 初始化验证器。
|
|
//
|
|
// Note:
|
|
// - Should be called once during application startup.
|
|
// - Creates a new validator instance with default settings.
|
|
//
|
|
// 注意:
|
|
// - 应在应用程序启动时调用一次。
|
|
// - 使用默认设置创建新的验证器实例。
|
|
func Init() {
|
|
Validator = validator.New()
|
|
logger.Info("validator initialized")
|
|
} |