Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 17 for Only (0.13 sec)

  1. schema/serializer.go

    		if rv.IsZero() {
    			return nil, nil
    		}
    		result = time.Unix(reflect.Indirect(rv).Int(), 0).UTC()
    	default:
    		err = fmt.Errorf("invalid field type %#v for UnixSecondSerializer, only int, uint supported", v)
    	}
    	return
    }
    
    // GobSerializer gob serializer
    type GobSerializer struct{}
    
    // Scan implements serializer interface
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 08:28:46 GMT 2024
    - 4.6K bytes
    - Viewed (0)
  2. tests/associations_has_many_test.go

    	if len(pets) != 1 {
    		t.Fatalf("should only find one pets, but got %v", len(pets))
    	}
    
    	CheckPet(t, pets[0], *user.Pets[0])
    
    	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)
    	}
    
    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. tests/embedded_struct_test.go

    		}
    	}
    
    	stmt := gorm.Statement{DB: DB}
    	if err := stmt.Parse(&EngadgetPost{}); err != nil {
    		t.Fatalf("failed to parse embedded struct")
    	} else if len(stmt.Schema.PrimaryFields) != 1 {
    		t.Errorf("should have only one primary field with embedded struct, but got %v", len(stmt.Schema.PrimaryFields))
    	}
    
    	for _, name := range []string{"user_id", "user_name", "user_email"} {
    		if !DB.Migrator().HasColumn(&HNPost{}, name) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Oct 26 03:58:13 GMT 2023
    - 7.3K bytes
    - Viewed (0)
  4. tests/upsert_test.go

    		t.Errorf("should only find only 3 languages, but got %+v", langs2)
    	}
    
    	DB.Clauses(clause.OnConflict{DoNothing: true}).Create(&langs)
    	var langs3 []Language
    	if err := DB.Find(&langs3, "code LIKE ?", "upsert-slice%").Error; err != nil {
    		t.Errorf("no error should happen when find languages with code, but got %v", err)
    	} else if len(langs3) != 3 {
    		t.Errorf("should only find only 3 languages, but got %+v", langs3)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Sep 05 07:39:19 GMT 2022
    - 11.4K bytes
    - Viewed (0)
  5. schema/relationship_test.go

    						References: []Reference{
    							{ForeignKey: "Type", ForeignSchema: "Toy", PrimaryValue: "users"},
    						},
    					},
    				},
    			},
    		})
    	})
    
    	t.Run("has one with only polymorphic type", func(t *testing.T) {
    		type Toy struct {
    			ID      int
    			Name    string
    			OwnerID int
    			Type    string
    		}
    
    		type Cat struct {
    			ID   int
    			Name string
    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)
  6. tests/create_test.go

    	AssertEqual(t, u2.Email, "on-conflict-user-email-2")
    	AssertEqual(t, u2.Mobile, "133xxxx")
    }
    
    func TestCreateFromMapWithoutPK(t *testing.T) {
    	if !isMysql() {
    		t.Skipf("This test case skipped, because of only supporting for mysql")
    	}
    
    	// case 1: one record, create from map[string]interface{}
    	mapValue1 := map[string]interface{}{"name": "create_from_map_with_schema1", "age": 1}
    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)
  7. chainable_api.go

    // Model specify the model you would like to run db operations
    //
    //	// update all users's name to `hello`
    //	db.Model(&User{}).Update("name", "hello")
    //	// if user's primary key is non-blank, will use it as condition, then will only update that user's name to `hello`
    //	db.Model(&user).Update("name", "hello")
    func (db *DB) Model(value interface{}) (tx *DB) {
    	tx = db.getInstance()
    	tx.Statement.Model = value
    	return
    }
    
    // Clauses Add clauses
    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)
  8. logger/sql.go

    	}
    	return true
    }
    
    // A list of Go types that should be converted to SQL primitives
    var convertibleTypes = []reflect.Type{reflect.TypeOf(time.Time{}), reflect.TypeOf(false), reflect.TypeOf([]byte{})}
    
    // RegEx matches only numeric values
    var numericPlaceholderRe = regexp.MustCompile(`\$\d+\$`)
    
    func isNumeric(k reflect.Kind) bool {
    	switch k {
    	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
    		return true
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 08:00:02 GMT 2024
    - 5K bytes
    - Viewed (0)
  9. callbacks/query.go

    							gussNestedRelations := make([]*schema.Relationship, 0, len(nestedJoinNames))
    							currentRelations := db.Statement.Schema.Relationships.Relations
    							for _, relname := range nestedJoinNames {
    								// incomplete match, only treated as raw sql
    								if relation, ok = currentRelations[relname]; ok {
    									gussNestedRelations = append(gussNestedRelations, relation)
    									currentRelations = relation.FieldSchema.Relationships.Relations
    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)
  10. migrator/migrator.go

    		return nil // skip primary key
    	}
    	// By default, ColumnType's Unique is not affected by UniqueIndex, so we don't care about UniqueIndex.
    	return m.RunWithValue(value, func(stmt *gorm.Statement) error {
    		// We're currently only receiving boolean values on `Unique` tag,
    		// so the UniqueConstraint name is fixed
    		constraint := m.DB.NamingStrategy.UniqueName(stmt.Table, field.DBName)
    		if unique && !field.Unique {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
Back to top