Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 17 for Round (0.12 sec)

  1. tests/helper_test.go

    	Company   bool
    	Manager   bool
    	Team      int
    	Languages int
    	Friends   int
    	NamedPet  bool
    	Tools     int
    }
    
    func GetUser(name string, config Config) *User {
    	var (
    		birthday = time.Now().Round(time.Second)
    		user     = User{
    			Name:     name,
    			Age:      18,
    			Birthday: &birthday,
    		}
    	)
    
    	if config.Account {
    		user.Account = Account{Number: name + "_account"}
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 8K bytes
    - Viewed (0)
  2. tests/associations_has_many_test.go

    	if count := DB.Model(&user).Where("name = ?", user.Pets[1].Name).Association("Pets").Count(); count != 1 {
    		t.Fatalf("should only find one pets, but got %v", count)
    	}
    
    	if count := DB.Model(&user).Where("name = ?", "not found").Association("Pets").Count(); count != 0 {
    		t.Fatalf("should only find no pet with invalid conditions, but got %v", count)
    	}
    
    	// Count
    	AssertAssociationCount(t, user, "Pets", 2, "")
    
    	// Append
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 15.6K bytes
    - Viewed (0)
  3. schema/relationship_test.go

    		if createdByRel.FieldSchema != userSchema {
    			t.Fatalf("expects same field schema, but got new %p, old %p", createdByRel.FieldSchema, userSchema)
    		}
    	} else {
    		t.Fatalf("expects created by relations, but not found")
    	}
    }
    
    func TestEmbeddedHas(t *testing.T) {
    	type Toy struct {
    		ID        int
    		Name      string
    		OwnerID   int
    		OwnerType string
    	}
    	type User struct {
    		ID  int
    		Cat struct {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 25.5K bytes
    - Viewed (0)
  4. schema/schema_helper_test.go

    		for idx, field := range primaryFields {
    			var found bool
    			for _, f := range s.PrimaryFields {
    				if f.Name == field {
    					found = true
    				}
    			}
    
    			if idx == 0 {
    				if field != s.PrioritizedPrimaryField.Name {
    					t.Errorf("schema %v prioritized primary field should be %v, but got %v", s, field, s.PrioritizedPrimaryField.Name)
    				}
    			}
    
    			if !found {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  5. tests/scopes_test.go

    	if len(users1) != 2 {
    		t.Errorf("Should found two users's name in 1, 2, but got %v", len(users1))
    	}
    
    	DB.Scopes(NameIn1And2, NameIn2And3).Find(&users2)
    	if len(users2) != 1 {
    		t.Errorf("Should found one user's name is 2, but got %v", len(users2))
    	}
    
    	DB.Scopes(NameIn([]string{users[0].Name, users[2].Name})).Find(&users3)
    	if len(users3) != 2 {
    		t.Errorf("Should found two users's name in 1, 3, but got %v", len(users3))
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 3.3K bytes
    - Viewed (0)
  6. chainable_api.go

    //
    // Attrs only adds attributes if the record is not found.
    //
    //	// assign an email if the record is not found
    //	db.Where(User{Name: "non_existing"}).Attrs(User{Email: "******@****.***"}).FirstOrInit(&user)
    //	// user -> User{Name: "non_existing", Email: "******@****.***"}
    //
    //	// assign an email if the record is not found, otherwise ignore provided email
    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)
  7. migrator/migrator.go

    							foundColumn = columnType
    							break
    						}
    					}
    
    					if foundColumn == nil {
    						// not found, add column
    						if err = execTx.Migrator().AddColumn(value, dbName); err != nil {
    							return err
    						}
    					} else {
    						// found, smartly migrate
    						field := stmt.Schema.FieldsByDBName[dbName]
    						if err = execTx.Migrator().MigrateColumn(value, field, foundColumn); err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  8. errors.go

    	// ErrRegistered registered
    	ErrRegistered = errors.New("registered")
    	// ErrInvalidField invalid field
    	ErrInvalidField = errors.New("invalid field")
    	// ErrEmptySlice empty slice found
    	ErrEmptySlice = errors.New("empty slice found")
    	// ErrDryRunModeUnsupported dry run mode unsupported
    	ErrDryRunModeUnsupported = errors.New("dry run mode unsupported")
    	// ErrInvalidDB invalid db
    	ErrInvalidDB = errors.New("invalid db")
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 02:53:17 GMT 2024
    - 2.5K bytes
    - Viewed (0)
  9. finisher_api.go

    				return
    			}
    		}
    	}
    }
    
    // FirstOrInit finds the first matching record, otherwise if not found initializes a new instance with given conds.
    // Each conds must be a struct or map.
    //
    // FirstOrInit never modifies the database. It is often used with Assign and Attrs.
    //
    //	// assign an email if the record is not found
    //	db.Where(User{Name: "non_existing"}).Attrs(User{Email: "******@****.***"}).FirstOrInit(&user)
    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)
  10. tests/migrate_test.go

    		}
    		var found gorm.ColumnType
    		for _, columnType := range columnTypes {
    			if columnType.Name() == fieldName {
    				found = columnType
    			}
    		}
    		if found == nil {
    			t.Fatalf("%v: failed to find column type %q", utils.FileWithLineNum(), fieldName)
    		}
    		if actualUnique, ok := found.Unique(); !ok || actualUnique != unique {
    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)
Back to top