Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 41 for errorea (0.28 sec)

  1. callbacks/create.go

    			defaultValueFieldsHavingValue := map[*schema.Field][]interface{}{}
    			for i := 0; i < rValLen; i++ {
    				rv := reflect.Indirect(stmt.ReflectValue.Index(i))
    				if !rv.IsValid() {
    					stmt.AddError(fmt.Errorf("slice data #%v is invalid: %w", i, gorm.ErrInvalidData))
    					return
    				}
    
    				values.Values[i] = make([]interface{}, len(values.Columns))
    				for idx, column := range values.Columns {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  2. logger/sql_test.go

    	"gorm.io/gorm/logger"
    )
    
    type JSON json.RawMessage
    
    func (j JSON) Value() (driver.Value, error) {
    	if len(j) == 0 {
    		return nil, nil
    	}
    	return json.RawMessage(j).MarshalJSON()
    }
    
    type ExampleStruct struct {
    	Name string
    	Val  string
    }
    
    func (s ExampleStruct) Value() (driver.Value, error) {
    	return json.Marshal(s)
    }
    
    func format(v []byte, escaper string) string {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 08:00:02 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  3. tests/update_test.go

    	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
    	if err := DB.Where("id = ?", user.ID).First(&result).Error; err != nil {
    		t.Errorf("errors happened when query: %v", err)
    	} else {
    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)
  4. tests/helper_test.go

    }
    
    func doCheckPet(t *testing.T, pet Pet, expect Pet, unscoped bool) {
    	if pet.ID != 0 {
    		var newPet Pet
    		if err := db(unscoped).Where("id = ?", pet.ID).First(&newPet).Error; err != nil {
    			t.Fatalf("errors happened when query: %v", err)
    		} else {
    			AssertObjEqual(t, newPet, pet, "ID", "CreatedAt", "UpdatedAt", "DeletedAt", "UserID", "Name")
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 8K bytes
    - Viewed (0)
  5. prepare_stmt.go

    }
    
    func (db *PreparedStmtDB) Ping() error {
    	conn, err := db.GetDBConn()
    	if err != nil {
    		return err
    	}
    	return conn.Ping()
    }
    
    type PreparedStmtTX struct {
    	Tx
    	PreparedStmtDB *PreparedStmtDB
    }
    
    func (db *PreparedStmtTX) GetDBConn() (*sql.DB, error) {
    	return db.PreparedStmtDB.GetDBConn()
    }
    
    func (tx *PreparedStmtTX) Commit() error {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 28 08:47:39 GMT 2024
    - 6.4K bytes
    - Viewed (0)
  6. schema/index_test.go

    	for k, ei := range expected {
    		t.Run(k, func(t *testing.T) {
    			ai, ok := actual[k]
    			if !ok {
    				t.Errorf("expected index %q but actual missing", k)
    				return
    			}
    			tests.AssertObjEqual(t, ai, ei, "Name", "Class", "Type", "Where", "Comment", "Option")
    			if len(ei.Fields) != len(ai.Fields) {
    				t.Errorf("expected index %q field length is %d but actual %d", k, len(ei.Fields), len(ai.Fields))
    				return
    			}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
  7. schema/index.go

    				}
    
    				if name == "" {
    					subName := field.Name
    					const key = "COMPOSITE"
    					if composite, found := settings[key]; found {
    						if len(composite) == 0 || composite == key {
    							err = fmt.Errorf(
    								"The composite tag of %s.%s cannot be empty",
    								field.Schema.Name,
    								field.Name)
    							return
    						}
    						subName = composite
    					}
    					name = field.Schema.namer.IndexName(
    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)
  8. tests/preload_test.go

    		t.Errorf("failed to query, got error %v, account: %#v", err, user4.Account)
    	}
    
    	if err := DB.Preload(clause.Associations, func(tx *gorm.DB) *gorm.DB {
    		return tx.Unscoped()
    	}).Take(&user4, "id = ?", users3[0].ID).Error; err != nil || user4.Account.ID == 0 {
    		t.Errorf("failed to query, got error %v, account: %#v", err, user4.Account)
    	}
    }
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 14.9K bytes
    - Viewed (0)
  9. callbacks/preload.go

    				tx.Statement.Unscoped = db.Statement.Unscoped
    				if err := preload(tx, rel, append(preloads[name], associationsConds...), preloadMap[name]); err != nil {
    					return err
    				}
    			}
    		} else {
    			return fmt.Errorf("%s: %w for schema %s", name, gorm.ErrUnsupportedRelation, db.Statement.Schema.Name)
    		}
    	}
    	return nil
    }
    
    func preloadDB(db *gorm.DB, reflectValue reflect.Value, dest interface{}) *gorm.DB {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  10. schema/schema_test.go

    		t.Fatalf("failed to parse pointer user, got error %v", err)
    	}
    
    	if customize.Table != "customize" {
    		t.Errorf("Failed to customize table with TableName method")
    	}
    }
    
    func TestNestedModel(t *testing.T) {
    	versionUser, err := schema.Parse(&VersionUser{}, &sync.Map{}, schema.NamingStrategy{})
    	if err != nil {
    		t.Fatalf("failed to parse nested user, got error %v", err)
    	}
    
    	fields := []schema.Field{
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
Back to top