Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 42 for Time (0.24 sec)

  1. tests/update_has_one_test.go

    	lastUpdatedAt := user2.Account.UpdatedAt
    	time.Sleep(time.Second)
    
    	if err := DB.Session(&gorm.Session{FullSaveAssociations: true}).Save(&user).Error; err != nil {
    		t.Fatalf("errors happened when update: %v", err)
    	}
    
    	var user4 User
    	DB.Preload("Account").Find(&user4, "id = ?", user.ID)
    
    	if lastUpdatedAt.Format(time.RFC3339) == user4.Account.UpdatedAt.Format(time.RFC3339) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jul 14 06:55:54 GMT 2022
    - 3.6K bytes
    - Viewed (0)
  2. tests/embedded_struct_test.go

    	}
    
    	type Author struct {
    		ID          string
    		Name        string
    		Email       string
    		Age         int
    		Content     Content
    		ContentPtr  *Content
    		Birthday    time.Time
    		BirthdayPtr *time.Time
    	}
    
    	type HNPost struct {
    		*BasePost
    		Upvotes int32
    		*Author `gorm:"EmbeddedPrefix:user_"` // Embedded struct
    	}
    
    	DB.Migrator().DropTable(&HNPost{})
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Oct 26 03:58:13 GMT 2023
    - 7.3K bytes
    - Viewed (0)
  3. schema/serializer.go

    	switch v := fieldValue.(type) {
    	case int64, int, uint, uint64, int32, uint32, int16, uint16:
    		result = time.Unix(reflect.Indirect(rv).Int(), 0).UTC()
    	case *int64, *int, *uint, *uint64, *int32, *uint32, *int16, *uint16:
    		if rv.IsZero() {
    			return nil, nil
    		}
    		result = time.Unix(reflect.Indirect(rv).Int(), 0).UTC()
    	default:
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 08:28:46 GMT 2024
    - 4.6K bytes
    - Viewed (0)
  4. tests/prepared_stmt_test.go

    	defer cancel()
    	txCtx := tx.WithContext(ctx)
    
    	user := *GetUser("prepared_stmt", Config{})
    
    	txCtx.Create(&user)
    
    	var result1 User
    	if err := txCtx.Find(&result1, user.ID).Error; err != nil {
    		t.Fatalf("no error should happen but got %v", err)
    	}
    
    	time.Sleep(time.Second)
    
    	var result2 User
    	if err := tx.Find(&result2, user.ID).Error; err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 07:55:43 GMT 2024
    - 4K bytes
    - Viewed (0)
  5. scan.go

    			*dest = append(*dest, mapValue)
    		}
    	case *int, *int8, *int16, *int32, *int64,
    		*uint, *uint8, *uint16, *uint32, *uint64, *uintptr,
    		*float32, *float64,
    		*bool, *string, *time.Time,
    		*sql.NullInt32, *sql.NullInt64, *sql.NullFloat64,
    		*sql.NullBool, *sql.NullString, *sql.NullTime:
    		for initialized || rows.Next() {
    			initialized = false
    			db.RowsAffected++
    			db.AddError(rows.Scan(dest))
    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)
  6. tests/soft_delete_test.go

    	}
    
    	if err := DB.Delete(&user).Error; err != nil {
    		t.Fatalf("No error should happen when soft delete user, but got %v", err)
    	}
    
    	if sql.NullTime(user.DeletedAt).Time.IsZero() {
    		t.Fatalf("user's deleted at is zero")
    	}
    
    	sql := DB.Session(&gorm.Session{DryRun: true}).Delete(&user).Statement.SQL.String()
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Feb 01 06:40:55 GMT 2023
    - 5.7K bytes
    - Viewed (0)
  7. callbacks.go

    package gorm
    
    import (
    	"context"
    	"errors"
    	"fmt"
    	"reflect"
    	"sort"
    	"time"
    
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    func initializeCallbacks(db *DB) *callbacks {
    	return &callbacks{
    		processors: map[string]*processor{
    			"create": {db: db},
    			"query":  {db: db},
    			"update": {db: db},
    			"delete": {db: db},
    			"row":    {db: db},
    			"raw":    {db: db},
    		},
    	}
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 8.6K bytes
    - Viewed (1)
  8. 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
    	NEW.First(&newUser, user.ID)
    
    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)
  9. utils/tests/utils.go

    		isEqual := func() {
    			if curTime, ok := got.(time.Time); ok {
    				format := "2006-01-02T15:04:05Z07:00"
    
    				if curTime.Round(time.Second).UTC().Format(format) != expect.(time.Time).Round(time.Second).UTC().Format(format) && curTime.Truncate(time.Second).UTC().Format(format) != expect.(time.Time).Truncate(time.Second).UTC().Format(format) {
    					t.Errorf("%v: expect: %v, got %v after time round", utils.FileWithLineNum(), expect.(time.Time), curTime)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Mar 10 09:21:56 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  10. logger/logger.go

    type traceRecorder struct {
    	Interface
    	BeginAt      time.Time
    	SQL          string
    	RowsAffected int64
    	Err          error
    }
    
    // New trace recorder
    func (l *traceRecorder) New() *traceRecorder {
    	return &traceRecorder{Interface: l.Interface, BeginAt: time.Now()}
    }
    
    // Trace implement logger interface
    func (l *traceRecorder) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Nov 07 02:19:41 GMT 2023
    - 5.8K bytes
    - Viewed (0)
Back to top