Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 88 for interface (0.36 sec)

  1. clause/where_test.go

    			[]interface{}{"1", 100},
    		},
    		{
    			[]clause.Interface{clause.Select{}, clause.From{}, clause.Where{
    				Exprs: []clause.Expression{clause.Not(clause.Expr{SQL: "`score` <= ?", Vars: []interface{}{100}},
    					clause.Expr{SQL: "`age` <= ?", Vars: []interface{}{60}})},
    			}},
    			"SELECT * FROM `users` WHERE NOT (`score` <= ? AND `age` <= ?)",
    			[]interface{}{100, 60},
    		},
    		{
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  2. schema/utils.go

    	var (
    		results       = [][]interface{}{}
    		dataResults   = map[string][]reflect.Value{}
    		loaded        = map[interface{}]bool{}
    		notZero, zero bool
    	)
    
    	if reflectValue.Kind() == reflect.Ptr ||
    		reflectValue.Kind() == reflect.Interface {
    		reflectValue = reflectValue.Elem()
    	}
    
    	switch reflectValue.Kind() {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Aug 19 13:35:14 GMT 2023
    - 5.5K bytes
    - Viewed (0)
  3. clause/group_by_test.go

    	results := []struct {
    		Clauses []clause.Interface
    		Result  string
    		Vars    []interface{}
    	}{
    		{
    			[]clause.Interface{clause.Select{}, clause.From{}, clause.GroupBy{
    				Columns: []clause.Column{{Name: "role"}},
    				Having:  []clause.Expression{clause.Eq{"role", "admin"}},
    			}},
    			"SELECT * FROM `users` GROUP BY `role` HAVING `role` = ?",
    			[]interface{}{"admin"},
    		},
    		{
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.1K bytes
    - Viewed (0)
  4. tests/scanner_valuer_test.go

    	}
    
    	if !reflect.DeepEqual([]interface{}{"jinzhu", "POINT(100 100)"}, stmt.Vars) {
    		t.Errorf("generated vars is not equal, got %v", stmt.Vars)
    	}
    
    	stmt = dryRunDB.Model(UserWithPoint{}).Create(map[string]interface{}{
    		"Name":  "jinzhu",
    		"Point": clause.Expr{SQL: "ST_PointFromText(?)", Vars: []interface{}{"POINT(100 100)"}},
    	}).Statement
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  5. callbacks/callmethod.go

    package callbacks
    
    import (
    	"reflect"
    
    	"gorm.io/gorm"
    )
    
    func callMethod(db *gorm.DB, fc func(value interface{}, tx *gorm.DB) bool) {
    	tx := db.Session(&gorm.Session{NewDB: true})
    	if called := fc(db.Statement.ReflectValue.Interface(), tx); !called {
    		switch db.Statement.ReflectValue.Kind() {
    		case reflect.Slice, reflect.Array:
    			db.Statement.CurDestIndex = 0
    			for i := 0; i < db.Statement.ReflectValue.Len(); i++ {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 846 bytes
    - Viewed (0)
  6. clause/from_test.go

    	"testing"
    
    	"gorm.io/gorm/clause"
    )
    
    func TestFrom(t *testing.T) {
    	results := []struct {
    		Clauses []clause.Interface
    		Result  string
    		Vars    []interface{}
    	}{
    		{
    			[]clause.Interface{clause.Select{}, clause.From{}},
    			"SELECT * FROM `users`", nil,
    		},
    		{
    			[]clause.Interface{
    				clause.Select{}, clause.From{
    					Tables: []clause.Table{{Name: "users"}},
    					Joins: []clause.Join{
    						{
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Jul 15 02:25:10 GMT 2020
    - 1.9K bytes
    - Viewed (0)
  7. prepare_stmt.go

    	if tx, ok := connPool.(Tx); ok {
    		return &PreparedStmtTX{PreparedStmtDB: db, Tx: tx}, nil
    	}
    	return nil, ErrInvalidTransaction
    }
    
    func (db *PreparedStmtDB) ExecContext(ctx context.Context, query string, args ...interface{}) (result sql.Result, err error) {
    	stmt, err := db.prepare(ctx, db.ConnPool, false, query)
    	if err == nil {
    		result, err = stmt.ExecContext(ctx, args...)
    		if errors.Is(err, driver.ErrBadConn) {
    			db.Mux.Lock()
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Mar 28 08:47:39 GMT 2024
    - 6.4K bytes
    - Viewed (0)
  8. schema/callbacks_test.go

    		if !reflect.Indirect(reflect.ValueOf(user)).FieldByName(str).Interface().(bool) {
    			t.Errorf("%v should be true", str)
    		}
    	}
    
    	for _, str := range []string{"BeforeCreate", "BeforeUpdate", "AfterUpdate", "AfterSave", "BeforeDelete", "AfterDelete", "AfterFind"} {
    		if reflect.Indirect(reflect.ValueOf(user)).FieldByName(str).Interface().(bool) {
    			t.Errorf("%v should be false", str)
    		}
    	}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 939 bytes
    - Viewed (0)
  9. tests/scan_test.go

    	}
    
    	type ID uint64
    	var id ID
    	DB.Raw("select id from users where id = ?", user2.ID).Scan(&id)
    	if uint(id) != user2.ID {
    		t.Errorf("Failed to scan to customized data type")
    	}
    
    	var resInt interface{}
    	resInt = &User{}
    	if err := DB.Table("users").Select("id, name, age").Where("id = ?", user3.ID).Find(&resInt).Error; err != nil {
    		t.Fatalf("Failed to query with pointer of value, got error %v", err)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat May 28 14:18:07 GMT 2022
    - 8.2K bytes
    - Viewed (0)
  10. tests/update_test.go

    	}
    
    	if err := DB.Model(&results[0]).Updates(map[string]interface{}{"age": gorm.Expr("age + ?", 100)}).Error; err != nil {
    		t.Errorf("Not error should happen when updating with gorm expr, but got %v", err)
    	}
    
    	if err := DB.Model(&results[1]).Clauses(clause.Returning{Columns: []clause.Column{{Name: "age"}}}).Updates(map[string]interface{}{"age": gorm.Expr("age + ?", 100)}).Error; err != nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Dec 04 03:50:58 GMT 2023
    - 30.3K bytes
    - Viewed (0)
Back to top