Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for now_utc (0.24 sec)

  1. callbacks/update.go

    								if field.AutoUpdateTime == schema.UnixNanosecond {
    									value = stmt.DB.NowFunc().UnixNano()
    								} else if field.AutoUpdateTime == schema.UnixMillisecond {
    									value = stmt.DB.NowFunc().UnixMilli()
    								} else if field.AutoUpdateTime == schema.UnixSecond {
    									value = stmt.DB.NowFunc().Unix()
    								} else {
    									value = stmt.DB.NowFunc()
    								}
    								isZero = false
    							}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 05:44:55 GMT 2024
    - 9.4K bytes
    - Viewed (1)
  2. callbacks/create_test.go

    			Email: "email",
    			Age:   18,
    		},
    		{
    			ID:    2,
    			Name:  "bob",
    			Email: "email",
    			Age:   19,
    		},
    	}
    	stmt := &gorm.Statement{
    		DB: &gorm.DB{
    			Config: &gorm.Config{
    				NowFunc: func() time.Time { return time.Time{} },
    			},
    			Statement: &gorm.Statement{
    				Settings: sync.Map{},
    				Schema:   s,
    			},
    		},
    		ReflectValue: reflect.ValueOf(dest),
    		Dest:         dest,
    	}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 05:48:42 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  3. callbacks/create.go

    				}
    			}
    			return called
    		})
    	}
    }
    
    // ConvertToCreateValues convert to create values
    func ConvertToCreateValues(stmt *gorm.Statement) (values clause.Values) {
    	curTime := stmt.DB.NowFunc()
    
    	switch value := stmt.Dest.(type) {
    	case map[string]interface{}:
    		values = ConvertMapToValuesForCreate(stmt, value)
    	case *map[string]interface{}:
    		values = ConvertMapToValuesForCreate(stmt, *value)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  4. tests/create_test.go

    }
    
    func TestCreateWithNowFuncOverride(t *testing.T) {
    	user := User{Name: "CreateUserTimestampOverride"}
    	curTime := now.MustParse("2016-01-01")
    
    	NEW := DB.Session(&gorm.Session{
    		NowFunc: func() time.Time {
    			return curTime
    		},
    	})
    
    	NEW.Save(&user)
    
    	AssertEqual(t, user.CreatedAt, curTime)
    	AssertEqual(t, user.UpdatedAt, curTime)
    
    	var newUser User
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 26.4K bytes
    - Viewed (0)
Back to top