Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 31 for 10 (8.38 sec)

  1. tests/hooks_test.go

    	tx.Statement.SetColumn("Price", s.Price+100)
    	return nil
    }
    
    func (s Product3) BeforeUpdate(tx *gorm.DB) (err error) {
    	if tx.Statement.Changed() {
    		tx.Statement.SetColumn("Price", s.Price+10)
    	}
    
    	if tx.Statement.Changed("Code") {
    		s.Price += 20
    		tx.Statement.SetColumn("Price", s.Price+30)
    	}
    	return nil
    }
    
    func TestSetColumn(t *testing.T) {
    	DB.Migrator().DropTable(&Product3{})
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
  2. clause/expression.go

    								appendFieldsToMap(reflectValue.Field(i))
    							}
    						}
    					}
    				}
    			}
    
    			appendFieldsToMap(reflect.ValueOf(value))
    		}
    	}
    
    	name := make([]byte, 0, 10)
    
    	for _, v := range []byte(expr.SQL) {
    		if v == '@' && !inName {
    			inName = true
    			name = name[:0]
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Oct 10 06:45:48 GMT 2023
    - 8.3K bytes
    - Viewed (0)
  3. tests/gorm_test.go

    			t.Fatalf("rows affected expects: %v, got %v", 1, results.RowsAffected)
    		}
    
    		u1 = user{} // important to reinitialize this before creating it again
    		u2 := user{}
    		db := DB.Session(&gorm.Session{CreateBatchSize: 10})
    
    		if results := db.Create([]*user{&u1, &u2}); results.Error != nil {
    			t.Fatalf("errors happened on create: %v", results.Error)
    		} else if results.RowsAffected != 2 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jun 01 07:22:21 GMT 2023
    - 3.3K bytes
    - Viewed (0)
  4. tests/group_by_test.go

    package tests_test
    
    import (
    	"testing"
    
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestGroupBy(t *testing.T) {
    	users := []User{{
    		Name:     "groupby",
    		Age:      10,
    		Birthday: Now(),
    		Active:   true,
    	}, {
    		Name:     "groupby",
    		Age:      20,
    		Birthday: Now(),
    	}, {
    		Name:     "groupby",
    		Age:      30,
    		Birthday: Now(),
    		Active:   true,
    	}, {
    		Name:     "groupby1",
    		Age:      110,
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 3.3K bytes
    - Viewed (0)
  5. schema/index_test.go

    	Name3        string `gorm:"index:,sort:desc,collate:utf8,type:btree,length:10,where:name3 != 'jinzhu'"`
    	Name4        string `gorm:"uniqueIndex"`
    	Name5        int64  `gorm:"index:,class:FULLTEXT,comment:hello \\, world,where:age > 10"`
    	Name6        int64  `gorm:"index:profile,comment:hello \\, world,where:age > 10"`
    	Age          int64  `gorm:"index:profile,expression:ABS(age),option:WITH PARSER parser_name"`
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
  6. tests/migrate_test.go

    		Field1 uint32  `gorm:"column:field1"`
    		Field2 float32 `gorm:"column:field2"`
    	}
    
    	if err := DB.AutoMigrate(&AutoIncrementStruct{}); err != nil {
    		t.Fatalf("AutoMigrate err: %v", err)
    	}
    
    	const ROWS = 10
    	for idx := 0; idx < ROWS; idx++ {
    		if err := DB.Create(&AutoIncrementStruct{}).Error; err != nil {
    			t.Fatalf("create auto_increment_struct fail, err: %v", err)
    		}
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  7. tests/scan_test.go

    type PersonAddressInfo struct {
    	Person  *Person  `gorm:"embedded"`
    	Address *Address `gorm:"embedded"`
    }
    
    func TestScan(t *testing.T) {
    	user1 := User{Name: "ScanUser1", Age: 1}
    	user2 := User{Name: "ScanUser2", Age: 10}
    	user3 := User{Name: "ScanUser3", Age: 20}
    	DB.Save(&user1).Save(&user2).Save(&user3)
    
    	type result struct {
    		ID   uint
    		Name string
    		Age  int
    	}
    
    	var res result
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat May 28 14:18:07 GMT 2022
    - 8.2K bytes
    - Viewed (0)
  8. .github/workflows/invalid_question.yml

    name: "Close invalid questions issues"
    on:
      schedule:
      - cron: "*/10 * * * *"
    
    permissions:
      contents: read
    
    jobs:
      stale:
        permissions:
          issues: write  # for actions/stale to close stale issues
          pull-requests: write  # for actions/stale to close stale PRs
        runs-on: ubuntu-latest
        env:
          ACTIONS_STEP_DEBUG: true
        steps:
        - name: Close Stale Issues
          uses: actions/stale@v8
          with:
    Others
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Apr 11 02:27:05 GMT 2023
    - 1.2K bytes
    - Viewed (0)
  9. schema/index.go

    				}
    
    				if (k == "UNIQUEINDEX") || settings["UNIQUE"] != "" {
    					settings["CLASS"] = "UNIQUE"
    				}
    
    				priority, err := strconv.Atoi(settings["PRIORITY"])
    				if err != nil {
    					priority = 10
    				}
    
    				indexes = append(indexes, Index{
    					Name:    name,
    					Class:   settings["CLASS"],
    					Type:    settings["TYPE"],
    					Where:   settings["WHERE"],
    					Comment: settings["COMMENT"],
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  10. tests/update_test.go

    		t.Fatalf("user's updated at should not zero, %v", user.UpdatedAt)
    	}
    	lastUpdatedAt = user.UpdatedAt
    
    	if err := DB.Model(user).Update("Age", 10).Error; err != nil {
    		t.Errorf("errors happened when update: %v", err)
    	} else if user.Age != 10 {
    		t.Errorf("Age should equals to 10, but got %v", user.Age)
    	}
    	checkUpdatedAtChanged("Update", user.UpdatedAt)
    	checkOtherData("Update")
    
    	var result User
    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)
Back to top