Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for zeros (0.14 sec)

  1. scan.go

    				isArrayKind = reflectValue.Kind() == reflect.Array
    			)
    
    			if !update || reflectValue.Len() == 0 {
    				update = false
    				if isArrayKind {
    					db.Statement.ReflectValue.Set(reflect.Zero(reflectValue.Type()))
    				} else {
    					// if the slice cap is externally initialized, the externally initialized slice is directly used here
    					if reflectValue.Cap() == 0 {
    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)
  2. tests/create_test.go

    		t.Errorf("user's primary key should has value after create, got : %v", user.ID)
    	}
    
    	if user.CreatedAt.IsZero() {
    		t.Errorf("user's created at should be not zero")
    	}
    
    	if user.UpdatedAt.IsZero() {
    		t.Errorf("user's updated at should be not zero")
    	}
    
    	var newUser User
    	if err := DB.Where("id = ?", user.ID).First(&newUser).Error; err != nil {
    		t.Fatalf("errors happened when query: %v", err)
    	} else {
    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)
  3. migrator/migrator.go

    	"regexp"
    	"strconv"
    	"strings"
    	"time"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/logger"
    	"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"
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  4. finisher_api.go

    		if result.Statement.Schema.PrioritizedPrimaryField == nil {
    			tx.AddError(ErrPrimaryKeyRequired)
    			break
    		}
    
    		primaryValue, zero := result.Statement.Schema.PrioritizedPrimaryField.ValueOf(tx.Statement.Context, resultsValue.Index(resultsValue.Len()-1))
    		if zero {
    			tx.AddError(ErrPrimaryKeyRequired)
    			break
    		}
    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)
  5. schema/utils.go

    		loaded        = map[interface{}]bool{}
    		notZero, zero bool
    	)
    
    	if reflectValue.Kind() == reflect.Ptr ||
    		reflectValue.Kind() == reflect.Interface {
    		reflectValue = reflectValue.Elem()
    	}
    
    	switch reflectValue.Kind() {
    	case reflect.Struct:
    		results = [][]interface{}{make([]interface{}, len(fields))}
    
    		for idx, field := range fields {
    			results[0][idx], zero = field.ValueOf(ctx, reflectValue)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Aug 19 13:35:14 GMT 2023
    - 5.5K bytes
    - Viewed (0)
  6. tests/update_test.go

    	}
    
    	if err := DB.Create(&users).Error; err != nil {
    		t.Fatalf("errors happened when create: %v", err)
    	} else if user.ID == 0 {
    		t.Fatalf("user's primary value should not zero, %v", user.ID)
    	} else if user.UpdatedAt.IsZero() {
    		t.Fatalf("user's updated at should not zero, %v", user.UpdatedAt)
    	}
    	lastUpdatedAt = user.UpdatedAt
    
    	if err := DB.Model(user).Update("Age", 10).Error; err != nil {
    		t.Errorf("errors happened when update: %v", err)
    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)
  7. tests/helper_test.go

    					"Birthday", "CompanyID", "ManagerID", "Active")
    			}
    		} else if user.ManagerID != nil {
    			t.Errorf("Manager should not be created for zero value, got: %+v", user.ManagerID)
    		}
    	})
    
    	t.Run("Team", func(t *testing.T) {
    		if len(user.Team) != len(expect.Team) {
    			t.Fatalf("Team should equal, expect: %v, got %v", len(expect.Team), len(user.Team))
    		}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 8K bytes
    - Viewed (0)
  8. statement.go

    				destValue := reflect.ValueOf(stmt.Dest)
    				for destValue.Kind() == reflect.Ptr {
    					destValue = destValue.Elem()
    				}
    
    				changedValue, zero := field.ValueOf(stmt.Context, destValue)
    				if v {
    					return !utils.AssertEqual(changedValue, fieldValue)
    				}
    				return !zero && !utils.AssertEqual(changedValue, fieldValue)
    			}
    		}
    		return false
    	}
    
    	if len(fields) == 0 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  9. schema/field.go

    						v = v.Elem()
    					} else {
    						return nil, true
    					}
    				}
    			}
    
    			fv, zero := v.Interface(), v.IsZero()
    			return fv, zero
    		}
    	}
    
    	if field.Serializer != nil {
    		oldValuerOf := field.ValueOf
    		field.ValueOf = func(ctx context.Context, v reflect.Value) (interface{}, bool) {
    			value, zero := oldValuerOf(ctx, v)
    
    			s, ok := value.(SerializerValuerInterface)
    			if !ok {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 32K bytes
    - Viewed (1)
  10. tests/query_test.go

    			})
    		}
    	}
    
    	var none []User
    	if err := DB.Where("name in (?)", []string{}).Find(&none).Error; err != nil || len(none) != 0 {
    		t.Errorf("errors happened when query find with in clause and zero length parameter: %v, length: %v", err, len(none))
    	}
    }
    
    func TestQueryWithAssociation(t *testing.T) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 49.8K bytes
    - Viewed (0)
Back to top