增加websocket支持
This commit is contained in:
38
vendor/gorm.io/gorm/chainable_api.go
generated
vendored
38
vendor/gorm.io/gorm/chainable_api.go
generated
vendored
@@ -367,12 +367,33 @@ func (db *DB) Scopes(funcs ...func(*DB) *DB) (tx *DB) {
|
||||
}
|
||||
|
||||
func (db *DB) executeScopes() (tx *DB) {
|
||||
tx = db.getInstance()
|
||||
scopes := db.Statement.scopes
|
||||
db.Statement.scopes = nil
|
||||
for _, scope := range scopes {
|
||||
db = scope(db)
|
||||
if len(scopes) == 0 {
|
||||
return tx
|
||||
}
|
||||
return db
|
||||
tx.Statement.scopes = nil
|
||||
|
||||
conditions := make([]clause.Interface, 0, 4)
|
||||
if cs, ok := tx.Statement.Clauses["WHERE"]; ok && cs.Expression != nil {
|
||||
conditions = append(conditions, cs.Expression.(clause.Interface))
|
||||
cs.Expression = nil
|
||||
tx.Statement.Clauses["WHERE"] = cs
|
||||
}
|
||||
|
||||
for _, scope := range scopes {
|
||||
tx = scope(tx)
|
||||
if cs, ok := tx.Statement.Clauses["WHERE"]; ok && cs.Expression != nil {
|
||||
conditions = append(conditions, cs.Expression.(clause.Interface))
|
||||
cs.Expression = nil
|
||||
tx.Statement.Clauses["WHERE"] = cs
|
||||
}
|
||||
}
|
||||
|
||||
for _, condition := range conditions {
|
||||
tx.Statement.AddClause(condition)
|
||||
}
|
||||
return tx
|
||||
}
|
||||
|
||||
// Preload preload associations with given conditions
|
||||
@@ -429,15 +450,6 @@ func (db *DB) Assign(attrs ...interface{}) (tx *DB) {
|
||||
return
|
||||
}
|
||||
|
||||
// Unscoped disables the global scope of soft deletion in a query.
|
||||
// By default, GORM uses soft deletion, marking records as "deleted"
|
||||
// by setting a timestamp on a specific field (e.g., `deleted_at`).
|
||||
// Unscoped allows queries to include records marked as deleted,
|
||||
// overriding the soft deletion behavior.
|
||||
// Example:
|
||||
// var users []User
|
||||
// db.Unscoped().Find(&users)
|
||||
// // Retrieves all users, including deleted ones.
|
||||
func (db *DB) Unscoped() (tx *DB) {
|
||||
tx = db.getInstance()
|
||||
tx.Statement.Unscoped = true
|
||||
|
||||
Reference in New Issue
Block a user