Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for jQuery (0.16 sec)

  1. tests/create_test.go

    		t.Fatalf("failed to query data after create from slice of map, got error %v", err)
    	}
    
    	var result3 User
    	if err := DB.Where("name = ?", "create_from_map_3").First(&result3).Error; err != nil || result3.Age != 20 {
    		t.Fatalf("failed to query data after create from slice of map, got error %v", err)
    	}
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 26.4K bytes
    - Viewed (0)
  2. callbacks/query.go

    package callbacks
    
    import (
    	"fmt"
    	"reflect"
    	"strings"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    func Query(db *gorm.DB) {
    	if db.Error == nil {
    		BuildQuerySQL(db)
    
    		if !db.DryRun && db.Error == nil {
    			rows, err := db.Statement.ConnPool.QueryContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...)
    			if err != nil {
    				db.AddError(err)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Jan 29 03:34:57 GMT 2024
    - 9.9K bytes
    - Viewed (0)
  3. chainable_api.go

    func (db *DB) Joins(query string, args ...interface{}) (tx *DB) {
    	return joins(db, clause.LeftJoin, query, args...)
    }
    
    // InnerJoins specify inner joins conditions
    // db.InnerJoins("Account").Find(&user)
    func (db *DB) InnerJoins(query string, args ...interface{}) (tx *DB) {
    	return joins(db, clause.InnerJoin, query, args...)
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  4. migrator/migrator.go

    		return
    	})
    
    	return columnTypes, execErr
    }
    
    // CreateView create view from Query in gorm.ViewOption.
    // Query in gorm.ViewOption is a [subquery]
    //
    //	// CREATE VIEW `user_view` AS SELECT * FROM `users` WHERE age > 20
    //	q := DB.Model(&User{}).Where("age > ?", 20)
    //	DB.Debug().Migrator().CreateView("user_view", gorm.ViewOption{Query: q})
    //
    //	// CREATE OR REPLACE VIEW `users_view` AS SELECT * FROM `users` WITH CHECK OPTION
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  5. finisher_api.go

    			tx.Statement.AddClause(clause.Where{Exprs: exprs})
    		}
    	}
    	tx.Statement.RaiseErrorOnNotFound = true
    	tx.Statement.Dest = dest
    	return tx.callbacks.Query().Execute(tx)
    }
    
    // Take finds the first record returned by the database in no specified order, matching given conditions conds
    func (db *DB) Take(dest interface{}, conds ...interface{}) (tx *DB) {
    	tx = db.Limit(1)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  6. tests/update_test.go

    		var first, last User
    		if err := DB.Where("id = ?", users[0].ID).First(&first).Error; err != nil {
    			t.Errorf("errors happened when query before user: %v", err)
    		}
    		CheckUser(t, first, *users[0])
    
    		if err := DB.Where("id = ?", users[2].ID).First(&last).Error; err != nil {
    			t.Errorf("errors happened when query after user: %v", err)
    		}
    		CheckUser(t, last, *users[2])
    	}
    
    	if err := DB.Create(&users).Error; err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Dec 04 03:50:58 GMT 2023
    - 30.3K bytes
    - Viewed (0)
  7. tests/scanner_valuer_test.go

    	}
    
    	var result ScannerValuerStruct
    
    	if err := DB.Find(&result, "id = ?", data.ID).Error; err != nil {
    		t.Fatalf("no error should happen when query scanner, valuer struct, but got %v", err)
    	}
    
    	if result.ExampleStructPtr.Val != "value2" {
    		t.Errorf(`ExampleStructPtr.Val should equal to "value2", but got %v`, result.ExampleStructPtr.Val)
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  8. tests/preload_test.go

    		t.Fatalf("failed to preload and find users: %v", err)
    	}
    
    	AssertEqual(t, result, users)
    	AssertEqual(t, len(query), 2) // Check preload queries are merged
    
    	if !regexp.MustCompile(`SELECT \* FROM .*tools.* WHERE .*IN.*`).MatchString(query[0]) {
    		t.Fatalf("Expected first query to preload manager tools, got: %s", query[0])
    	}
    }
    
    func TestEmbedPreload(t *testing.T) {
    	type Country struct {
    		ID   int `gorm:"primaryKey"`
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 14.9K bytes
    - Viewed (0)
  9. statement.go

    	if c, ok := stmt.Clauses[v.Name()]; !ok || c.Expression == nil {
    		stmt.AddClause(v)
    	}
    }
    
    // BuildCondition build condition
    func (stmt *Statement) BuildCondition(query interface{}, args ...interface{}) []clause.Expression {
    	if s, ok := query.(string); ok {
    		// if it is a number, then treats it as primary key
    		if _, err := strconv.Atoi(s); err != nil {
    			if s == "" && len(args) == 0 {
    				return nil
    			}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  10. callbacks/preload.go

    	}
    	return names
    }
    
    // preloadEntryPoint enters layer by layer. It will call real preload if it finds the right entry point.
    // If the current relationship is embedded or joined, current query will be ignored.
    //
    //nolint:cyclop
    func preloadEntryPoint(db *gorm.DB, joins []string, relationships *schema.Relationships, preloads map[string][]interface{}, associationsConds []interface{}) error {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
Back to top