Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 16 for some (0.12 sec)

  1. tests/postgres_test.go

    		SomeID  string
    		OtherID string
    		Data    string
    	}
    
    	DB.Migrator().DropTable(&Thing{})
    	DB.Migrator().CreateTable(&Thing{})
    	if err := DB.Exec("ALTER TABLE things ADD CONSTRAINT some_id_other_id_unique UNIQUE (some_id, other_id)").Error; err != nil {
    		t.Error(err)
    	}
    
    	thing := Thing{
    		SomeID:  "1234",
    		OtherID: "1234",
    		Data:    "something",
    	}
    
    	DB.Create(&thing)
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Oct 08 09:16:32 GMT 2022
    - 6.4K bytes
    - Viewed (3)
  2. tests/associations_has_many_test.go

    		[]*Pet{{Name: "pet-slice-append-2-1"}, {Name: "pet-slice-append-2-2"}},
    		&Pet{Name: "pet-slice-append-3"},
    	)
    
    	AssertAssociationCount(t, users, "Pets", 10, "After Append")
    
    	// Replace -> same as append
    	DB.Model(&users).Association("Pets").Replace(
    		[]*Pet{{Name: "pet-slice-replace-1-1"}, {Name: "pet-slice-replace-1-2"}},
    		[]*Pet{{Name: "pet-slice-replace-2-1"}, {Name: "pet-slice-replace-2-2"}},
    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/soft_delete_test.go

    	expected := &gorm.Model{}
    	b, _ := json.Marshal(expected)
    
    	result := &gorm.Model{}
    	_ = json.Unmarshal(b, result)
    	if result.DeletedAt != expected.DeletedAt {
    		t.Errorf("Failed, result.DeletedAt: %v is not same as expected.DeletedAt: %v", result.DeletedAt, expected.DeletedAt)
    	}
    }
    
    func TestDeletedAtOneOr(t *testing.T) {
    	actualSQL := DB.ToSQL(func(tx *gorm.DB) *gorm.DB {
    		return tx.Or("id = ?", 1).Find(&User{})
    	})
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Feb 01 06:40:55 GMT 2023
    - 5.7K bytes
    - Viewed (0)
  4. scan.go

    				relValue = joinSchema.ReflectValueOf(db.Statement.Context, currentReflectValue)
    				if relValue.Kind() == reflect.Ptr {
    					fullRelsName := utils.JoinNestedRelationNames(fullRels)
    					// same nested structure
    					if _, ok := joinedNestedSchemaMap[fullRelsName]; !ok {
    						if value := reflect.ValueOf(values[idx]).Elem(); value.Kind() == reflect.Ptr && value.IsNil() {
    							isNilPtrValue = true
    							break
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 09:53:11 GMT 2024
    - 9.8K bytes
    - Viewed (0)
  5. schema/relationship_test.go

    	if err != nil {
    		t.Fatalf("failed to parse schema")
    	}
    
    	relSchema := user.Relationships.Relations["Creators"].FieldSchema
    	if user != relSchema {
    		t.Fatalf("schema should be same, expects %p but got %p", user, relSchema)
    	}
    }
    
    type CreatedByModel struct {
    	CreatedByID uint
    	CreatedBy   *CreatedUser
    }
    
    type CreatedUser struct {
    	gorm.Model
    	CreatedByModel
    }
    
    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. chainable_api.go

    		tx.Statement.AddClause(clause.Where{Exprs: conds})
    	}
    	return
    }
    
    // Not add NOT conditions
    //
    // Not works similarly to where, and has the same syntax.
    //
    //	// Find the first user with name not equal to jinzhu
    //	db.Not("name = ?", "jinzhu").First(&user)
    func (db *DB) Not(query interface{}, args ...interface{}) (tx *DB) {
    	tx = db.getInstance()
    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

    }
    
    // AddColumn create `name` column for value
    func (m Migrator) AddColumn(value interface{}, name string) error {
    	return m.RunWithValue(value, func(stmt *gorm.Statement) error {
    		// avoid using the same name field
    		if stmt.Schema == nil {
    			return errors.New("failed to get schema")
    		}
    		f := stmt.Schema.LookUpField(name)
    		if f == nil {
    			return fmt.Errorf("failed to look up field with name: %s", name)
    		}
    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. tests/migrate_test.go

    	AssertEqual(t, nil, err)
    }
    
    func TestMigrateWithDefaultValue(t *testing.T) {
    	if DB.Dialector.Name() == "sqlserver" {
    		// sqlserver driver treats NULL and 'NULL' the same
    		t.Skip("skip sqlserver")
    	}
    
    	type NullModel struct {
    		ID      uint
    		Content string `gorm:"default:null"`
    	}
    
    	type NullStringModel struct {
    		ID      uint
    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)
  9. tests/scanner_valuer_test.go

    		ExampleStructPtr: &ExampleStruct{"name", "value2"},
    	}
    
    	var result ScannerValuerStruct
    	tx := DB.Where(data).FirstOrCreate(&result)
    
    	if tx.RowsAffected != 1 {
    		t.Errorf("RowsAffected should be 1 after create some record")
    	}
    
    	if tx.Error != nil {
    		t.Errorf("Should not raise any error, but got %v", tx.Error)
    	}
    
    	AssertObjEqual(t, result, data, "Name", "Gender", "Age")
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  10. schema/index.go

    	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
    	Sort       string // DESC, ASC
    	Collate    string
    	Length     int
    	priority   int
    }
    
    // ParseIndexes parse schema indexes
    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)
Back to top