Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 20 for Hata (0.12 sec)

  1. tests/create_test.go

    	}
    }
    
    func TestCreateEmptySlice(t *testing.T) {
    	data := []User{}
    	if err := DB.Create(&data).Error; err != gorm.ErrEmptySlice {
    		t.Errorf("no data should be created, got %v", err)
    	}
    
    	sliceMap := []map[string]interface{}{}
    	if err := DB.Model(&User{}).Create(&sliceMap).Error; err != gorm.ErrEmptySlice {
    		t.Errorf("no data should be created, got %v", err)
    	}
    }
    
    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. tests/associations_has_many_test.go

    	}
    	AssertAssociationCount(t, user2, "Pets", 1, "after delete non-existing data")
    
    	if err := DB.Model(&user2).Association("Pets").Delete(&pet2); err != nil {
    		t.Fatalf("Error happened when delete Pets, got %v", err)
    	}
    	AssertAssociationCount(t, user2, "Pets", 0, "after delete")
    
    	// Prepare Data for Clear
    	if err := DB.Model(&user2).Association("Pets").Append(&pet); err != nil {
    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. scan.go

    				f := joinFields[idx][len(joinFields[idx])-1]
    				db.AddError(f.Set(db.Statement.Context, relValue, values[idx]))
    			}
    		}
    
    		// release data to pool
    		field.NewValuePool.Put(values[idx])
    	}
    }
    
    // ScanMode scan data mode
    type ScanMode uint8
    
    // scan modes
    const (
    	ScanInitialized         ScanMode = 1 << 0 // 1
    	ScanUpdate              ScanMode = 1 << 1 // 2
    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)
  4. schema/relationship_test.go

    package schema_test
    
    import (
    	"sync"
    	"testing"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/schema"
    )
    
    func checkStructRelation(t *testing.T, data interface{}, relations ...Relation) {
    	if s, err := schema.Parse(data, &sync.Map{}, schema.NamingStrategy{}); err != nil {
    		t.Errorf("Failed to parse schema, got error %v", err)
    	} else {
    		for _, rel := range relations {
    			checkSchemaRelation(t, s, rel)
    		}
    	}
    }
    
    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)
  5. tests/hooks_test.go

    	if product.Price != 150 || product.Code != "L1212" {
    		t.Errorf("invalid data after update, got %+v", product)
    	}
    
    	// Code not changed, price should not change
    	DB.Model(&product).Updates(map[string]interface{}{"Name": "Product New"})
    
    	if product.Name != "Product New" || product.Price != 160 || product.Code != "L1212" {
    		t.Errorf("invalid data after update, got %+v", product)
    	}
    
    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)
  6. migrator/migrator.go

    	sql, _ := fc()
    	fmt.Println(sql + ";")
    	l.Interface.Trace(ctx, begin, fc, err)
    }
    
    // GormDataTypeInterface gorm data type interface
    type GormDataTypeInterface interface {
    	GormDBDataType(*gorm.DB, *schema.Field) string
    }
    
    // RunWithValue run migration with statement value
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  7. 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)
  8. finisher_api.go

    import (
    	"database/sql"
    	"errors"
    	"fmt"
    	"reflect"
    	"strings"
    
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/logger"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    // Create inserts value, returning the inserted data's primary key in value's id
    func (db *DB) Create(value interface{}) (tx *DB) {
    	if db.CreateBatchSize > 0 {
    		return db.CreateInBatches(value, db.CreateBatchSize)
    	}
    
    	tx = db.getInstance()
    	tx.Statement.Dest = value
    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)
  9. tests/scanner_valuer_test.go

    		t.Errorf("Should got no error when creating data, but got %v", err)
    	}
    
    	if err := DB.Model(&data).Update("password", EncryptedData("xnewpass")).Error; err == nil {
    		t.Errorf("Should failed to update data with invalid data")
    	}
    
    	if err := DB.Model(&data).Update("password", EncryptedData("newpass")).Error; err != nil {
    		t.Errorf("Should got no error update data with valid data, but got %v", err)
    	}
    
    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. tests/update_test.go

    	DB.Create(&user)
    
    	if err := DB.Model(&user).Updates(map[string]string{"name": "jinzhu"}).Error; !errors.Is(err, gorm.ErrInvalidData) {
    		t.Errorf("should returns error for unsupported updating data")
    	}
    }
    
    func TestOmitWithUpdate(t *testing.T) {
    	user := *GetUser("omit_update", Config{Account: true, Pets: 3, Toys: 3, Company: true, Manager: true, Team: 3, Languages: 3, Friends: 4})
    	DB.Create(&user)
    
    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)
Back to top