Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 42 for and (0.15 sec)

  1. clause/where_test.go

    			}},
    			"SELECT * FROM `users` WHERE (`users`.`id` <> ? AND `age` <= ?) OR `name` <> ? AND (`score` <= ? OR `name` LIKE ?)",
    			[]interface{}{"1", 18, "jinzhu", 100, "%linus%"},
    		},
    		{
    			[]clause.Interface{clause.Select{}, clause.From{}, clause.Where{
    				Exprs: []clause.Expression{clause.And(clause.Eq{Column: "age", Value: 18}, clause.Or(clause.Neq{Column: "name", Value: "jinzhu"}))},
    			}},
    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/index_test.go

    		FieldF1 string `gorm:"uniqueIndex:uniq_field_f1_f2;index"` // mul uniqueIndex and index
    		FieldF2 string `gorm:"uniqueIndex:uniq_field_f1_f2;"`
    
    		FieldG string `gorm:"unique;uniqueIndex"` // unique and uniqueIndex
    
    		FieldH1 string `gorm:"unique;uniqueIndex:uniq_field_h1_h2"` // unique and mul uniqueIndex
    		FieldH2 string `gorm:"uniqueIndex:uniq_field_h1_h2"`        // unique and mul uniqueIndex
    	}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
  3. clause/group_by_test.go

    			}, clause.GroupBy{
    				Columns: []clause.Column{{Name: "gender"}},
    				Having:  []clause.Expression{clause.Neq{"gender", "U"}},
    			}},
    			"SELECT * FROM `users` GROUP BY `role`,`gender` HAVING `role` = ? AND `gender` <> ?",
    			[]interface{}{"admin", "U"},
    		},
    	}
    
    	for idx, result := range results {
    		t.Run(fmt.Sprintf("case #%v", idx), func(t *testing.T) {
    			checkBuildClauses(t, result.Clauses, result.Result, result.Vars)
    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. prepare_stmt.go

    	// suppose the maxopen is 1, g1 is creating record and g2 is querying record.
    	// 1. g1 begin tx, g1 is requeue because of waiting for the system call, now `db.ConnPool` db.numOpen == 1.
    	// 2. g2 select lock `conn.PrepareContext(ctx, query)`, now db.numOpen == db.maxOpen , wait for release.
    	// 3. g1 tx exec insert, wait for unlock `conn.PrepareContext(ctx, query)` to finish tx and release.
    	stmt, err := conn.PrepareContext(ctx, query)
    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)
  5. schema/index.go

    package schema
    
    import (
    	"fmt"
    	"sort"
    	"strconv"
    	"strings"
    )
    
    type Index struct {
    	Name    string
    	Class   string // UNIQUE | FULLTEXT | SPATIAL
    	Type    string // btree, hash, gist, spgist, gin, and brin
    	Where   string
    	Comment string
    	Option  string        // WITH PARSER parser_name
    	Fields  []IndexOption // Note: IndexOption's Field maybe the same
    }
    
    type IndexOption struct {
    	*Field
    	Expression string
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  6. tests/update_test.go

    		t.Fatalf("user's updated at should not zero, %v", users[0].UpdatedAt)
    	}
    
    	if rowsAffected := DB.Model(&User{}).Clauses(clause.From{Tables: []clause.Table{{Name: "accounts"}}}).Where("accounts.user_id = users.id AND accounts.number = ? AND accounts.deleted_at IS NULL", users[0].Account.Number).Update("name", "franco").RowsAffected; rowsAffected != 1 {
    		t.Errorf("should only update one record, but got %v", rowsAffected)
    	}
    
    	var result User
    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)
  7. tests/transaction_test.go

    	}
    
    	tx2.Commit()
    
    	if err := DB.First(&User{}, "name = ?", "transaction-2").Error; err != nil {
    		t.Fatalf("Should be able to find committed record, but got %v", err)
    	}
    
    	t.Run("this is test nested transaction and prepareStmt coexist case", func(t *testing.T) {
    		// enable prepare statement
    		tx3 := DB.Session(&gorm.Session{PrepareStmt: true})
    		if err := tx3.Transaction(func(tx4 *gorm.DB) error {
    			// nested transaction
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  8. schema/field_test.go

    		}
    	}
    	newValues["updated_at"] = time.Time{}
    	newValues["active"] = false
    	checkField(t, userSchema, reflectValue, newValues)
    
    	// test valuer and other type
    	age := myint(10)
    	var nilTime *time.Time
    	newValues2 := map[string]interface{}{
    		"name":       sql.NullString{String: "valuer_and_setter_3", Valid: true},
    		"id":         &sql.NullInt64{Int64: 3, Valid: true},
    		"created_at": tests.Now(),
    		"updated_at": nilTime,
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Feb 19 09:02:53 GMT 2022
    - 12.7K bytes
    - Viewed (0)
  9. statement.go

    							return []clause.Expression{clause.And(conds...)}
    						}
    						return nil
    					}
    				}
    
    				conds = append(conds, clause.IN{Column: clause.PrimaryColumn, Values: args})
    			}
    		}
    	}
    
    	if len(conds) > 0 {
    		return []clause.Expression{clause.And(conds...)}
    	}
    	return nil
    }
    
    // Build build sql with clauses names
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  10. tests/multi_primary_keys_test.go

    	}
    
    	DB.Model(&blog2).Association("LocaleTags").Find(&tags)
    	if len(tags) != 0 {
    		t.Fatalf("Should find 0 tags for EN Blog")
    	}
    
    	var blog1 Blog
    	DB.Preload("LocaleTags").Find(&blog1, "locale = ? AND id = ?", "ZH", blog.ID)
    	if !compareTags(blog1.LocaleTags, []string{"tag1", "tag2", "tag3"}) {
    		t.Fatalf("Preload many2many relations")
    	}
    
    	tag4 := &Tag{Locale: "ZH", Value: "tag4"}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 12.8K bytes
    - Viewed (0)
Back to top