Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for now_utc (0.19 sec)

  1. gorm.go

    	}
    
    	if config.QueryFields {
    		tx.Config.QueryFields = true
    	}
    
    	if config.Logger != nil {
    		tx.Config.Logger = config.Logger
    	}
    
    	if config.NowFunc != nil {
    		tx.Config.NowFunc = config.NowFunc
    	}
    
    	if config.Initialized {
    		tx = tx.getInstance()
    	}
    
    	return tx
    }
    
    // WithContext change current instance db's context to ctx
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
  2. 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 21 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 05:44:55 GMT 2024
    - 9.4K bytes
    - Viewed (1)
  3. 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 21 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 05:48:42 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  4. soft_delete.go

    }
    
    func (sd SoftDeleteDeleteClause) MergeClause(*clause.Clause) {
    }
    
    func (sd SoftDeleteDeleteClause) ModifyStatement(stmt *Statement) {
    	if stmt.SQL.Len() == 0 && !stmt.Statement.Unscoped {
    		curTime := stmt.DB.NowFunc()
    		stmt.AddClause(clause.Set{{Column: clause.Column{Name: sd.Field.DBName}, Value: curTime}})
    		stmt.SetColumn(sd.Field.DBName, curTime, true)
    
    		if stmt.Schema != nil {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Feb 01 06:40:55 GMT 2023
    - 4.5K bytes
    - Viewed (0)
  5. 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 21 09:35:09 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  6. 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 21 09:35:09 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 26.4K bytes
    - Viewed (0)
Back to top