Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for Ehat (0.15 sec)

  1. tests/create_test.go

    		GetUser("invalid_slice_2", Config{}),
    		nil,
    	}
    
    	if err := DB.Create(&users).Error; !errors.Is(err, gorm.ErrInvalidData) {
    		t.Errorf("should returns error invalid data when creating from slice that contains invalid data")
    	}
    }
    
    func TestCreateWithExistingTimestamp(t *testing.T) {
    	user := User{Name: "CreateUserExistingTimestamp"}
    	curTime := now.MustParse("2016-01-01")
    	user.CreatedAt = curTime
    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)
  2. chainable_api.go

    //
    //	// 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)
  3. logger/sql.go

    	nullStr     = "NULL"
    )
    
    func isPrintable(s string) bool {
    	for _, r := range s {
    		if !unicode.IsPrint(r) {
    			return false
    		}
    	}
    	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
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 08:00:02 GMT 2024
    - 5K bytes
    - Viewed (0)
  4. tests/hooks_test.go

    		t.Fatalf("An error from before create callbacks happened when create with invalid value")
    	}
    
    	if DB.Where("code = ?", "Invalid").First(&Product{}).Error == nil {
    		t.Fatalf("Should not save record that have errors")
    	}
    
    	if DB.Save(&Product{Code: "dont_save", Price: 100}).Error == nil {
    		t.Fatalf("An error from after create callbacks happened when create with invalid value")
    	}
    
    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)
  5. migrator/migrator.go

    	"gorm.io/gorm/schema"
    )
    
    // This regular expression seeks to find a sequence of digits (\d+) among zero or more non-digit characters (\D*),
    // with a possible trailing non-digit character (\D?).
    
    // For example, values that can pass this regular expression are:
    // - "123"
    // - "abc456"
    // -"%$#@789"
    var regFullDataType = regexp.MustCompile(`\D*(\d+)\D?`)
    
    // TODO:? Create const vars for raw sql queries ?
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  6. tests/customize_field_test.go

    		t.Errorf("Failed to query CustomizeColumn")
    	}
    }
    
    func TestCustomColumnAndIgnoredFieldClash(t *testing.T) {
    	// Make sure an ignored field does not interfere with another field's custom
    	// column name that matches the ignored field.
    	type CustomColumnAndIgnoredFieldClash struct {
    		Body    string `gorm:"-"`
    		RawBody string `gorm:"column:body"`
    	}
    
    	DB.Migrator().DropTable(&CustomColumnAndIgnoredFieldClash{})
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Sep 11 09:33:31 GMT 2020
    - 6.9K bytes
    - Viewed (0)
  7. tests/update_test.go

    	DB.Create(&user)
    
    	// Update a single field of the user and verify that the changed address is not stored.
    	newAge := uint(100)
    	user.Account.Number = "new_account_number"
    	db := DB.Model(&user).UpdateColumns(User{Age: newAge})
    
    	if db.RowsAffected != 1 {
    		t.Errorf("Expected RowsAffected=1 but instead RowsAffected=%v", db.RowsAffected)
    	}
    
    	// Verify that Age now=`newAge`.
    	result := &User{}
    	result.ID = user.ID
    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)
  8. schema/schema.go

    			}
    		}
    	}
    
    	return schema, schema.err
    }
    
    // This unrolling is needed to show to the compiler the exact set of methods
    // that can be used on the modelType.
    // Prior to go1.22 any use of MethodByName would cause the linker to
    // abandon dead code elimination for the entire binary.
    // As of go1.22 the compiler supports one special case of a string constant
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Oct 10 06:50:29 GMT 2023
    - 13.7K bytes
    - Viewed (0)
  9. tests/sql_builder_test.go

    			Columns: []clause.OrderByColumn{{Column: clause.Column{Name: "id", Raw: true}, Desc: true}},
    		})
    	})
    	assertEqualSQL(t, `SELECT * FROM users ORDER BY id DESC`, sql)
    }
    
    // assertEqualSQL for assert that the sql is equal, this method will ignore quote, and dialect specials.
    func assertEqualSQL(t *testing.T, expected string, actually string) {
    	t.Helper()
    
    	// replace SQL quote, convert into postgresql like ""
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 16.7K bytes
    - Viewed (0)
Back to top