mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 06:47:20 +08:00
fix: lint
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user