From 6cec73646735af2a9e84f49b0c3426d9f6686102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Fri, 17 Jan 2025 03:45:19 +0800 Subject: [PATCH] fix: lint --- internal/http/rule/exists.go | 6 +++--- internal/http/rule/not_exists.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/http/rule/exists.go b/internal/http/rule/exists.go index 9843f642..80d25cd2 100644 --- a/internal/http/rule/exists.go +++ b/internal/http/rule/exists.go @@ -13,11 +13,11 @@ import ( // 例子:exists:users,phone,email // Example: exists:users,phone,email type Exists struct { - DB *gorm.DB + db *gorm.DB } func NewExists(db *gorm.DB) *Exists { - return &Exists{DB: db} + return &Exists{db: db} } func (r *Exists) Passes(val any, options ...any) bool { @@ -28,7 +28,7 @@ func (r *Exists) Passes(val any, options ...any) bool { tableName := options[0].(string) fieldNames := options[1:] - query := r.DB.Table(tableName).Where(fmt.Sprintf("%s = ?", fieldNames[0]), val) + query := r.db.Table(tableName).Where(fmt.Sprintf("%s = ?", fieldNames[0]), val) for _, fieldName := range fieldNames[1:] { query = query.Or(fmt.Sprintf("%s = ?", fieldName), val) } diff --git a/internal/http/rule/not_exists.go b/internal/http/rule/not_exists.go index e703d5fa..81974e96 100644 --- a/internal/http/rule/not_exists.go +++ b/internal/http/rule/not_exists.go @@ -13,11 +13,11 @@ import ( // 例子:notExists:users,phone,email // Example: notExists:users,phone,email type NotExists struct { - DB *gorm.DB + db *gorm.DB } func NewNotExists(db *gorm.DB) *NotExists { - return &NotExists{DB: db} + return &NotExists{db: db} } func (r *NotExists) Passes(val any, options ...any) bool { @@ -28,7 +28,7 @@ func (r *NotExists) Passes(val any, options ...any) bool { tableName := options[0].(string) fieldNames := options[1:] - query := r.DB.Table(tableName).Where(fmt.Sprintf("%s = ?", fieldNames[0]), val) + query := r.db.Table(tableName).Where(fmt.Sprintf("%s = ?", fieldNames[0]), val) for _, fieldName := range fieldNames[1:] { query = query.Or(fmt.Sprintf("%s = ?", fieldName), val) }