2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 06:47:20 +08:00

fix: lint

This commit is contained in:
耗子
2025-01-17 03:45:19 +08:00
parent f6bd27a0cb
commit 6cec736467
2 changed files with 6 additions and 6 deletions

View File

@@ -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)
}

View File

@@ -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)
}