Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 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. callbacks/associations.go

    					for i := 0; i < rValLen; i++ {
    						obj := db.Statement.ReflectValue.Index(i)
    						if reflect.Indirect(obj).Kind() != reflect.Struct {
    							break
    						}
    						if _, zero := rel.Field.ValueOf(db.Statement.Context, obj); !zero { // check belongs to relation value
    							rv := rel.Field.ReflectValueOf(db.Statement.Context, obj) // relation reflect value
    							if !isPtr {
    								rv = rv.Addr()
    							}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  4. 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)
  5. 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)
  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. 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)
  8. association.go

    				if _, zero := rel.Field.ValueOf(association.DB.Statement.Context, data); !zero {
    					fieldValue := reflect.Indirect(rel.Field.ReflectValueOf(association.DB.Statement.Context, data))
    					primaryValues := make([]interface{}, len(rel.FieldSchema.PrimaryFields))
    
    					switch fieldValue.Kind() {
    					case reflect.Slice, reflect.Array:
    						validFieldValues := reflect.Zero(rel.Field.IndirectFieldType)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K 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)
Back to top