Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for mtime (0.16 sec)

  1. schema/field_test.go

    		name          = "advanced_data_type_valuer_and_setter"
    		deletedAt     = mytime(time.Now())
    		isAdmin       = mybool(false)
    		user          = AdvancedDataTypeUser{
    			ID:           sql.NullInt64{Int64: 10, Valid: true},
    			Name:         &sql.NullString{String: name, Valid: true},
    			Birthday:     sql.NullTime{Time: time.Now(), Valid: true},
    			RegisteredAt: mytime(time.Now()),
    			DeletedAt:    &deletedAt,
    			Active:       mybool(true),
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 19 09:02:53 GMT 2022
    - 12.7K bytes
    - Viewed (0)
  2. schema/model_test.go

    	Active    *bool
    }
    
    type (
    	mytime time.Time
    	myint  int
    	mybool = bool
    )
    
    type AdvancedDataTypeUser struct {
    	ID           sql.NullInt64
    	Name         *sql.NullString
    	Birthday     sql.NullTime
    	RegisteredAt mytime
    	DeletedAt    *mytime
    	Active       mybool
    	Admin        *mybool
    }
    
    type BaseModel struct {
    	ID        uint
    	CreatedAt time.Time
    	CreatedBy *int
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.1K bytes
    - Viewed (0)
  3. schema/field.go

    		switch fieldValue.Elem().Interface().(type) {
    		case time.Time:
    			field.Set = func(ctx context.Context, value reflect.Value, v interface{}) error {
    				switch data := v.(type) {
    				case **time.Time:
    					if data != nil && *data != nil {
    						field.Set(ctx, value, *data)
    					}
    				case time.Time:
    					field.ReflectValueOf(ctx, value).Set(reflect.ValueOf(v))
    				case *time.Time:
    					if data != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 32K bytes
    - Viewed (1)
  4. tests/non_std_test.go

    package tests_test
    
    import (
    	"testing"
    	"time"
    )
    
    type Animal struct {
    	Counter    uint64 `gorm:"primary_key:yes"`
    	Name       string `gorm:"DEFAULT:'galeone'"`
    	From       string // test reserved sql keyword as field name
    	Age        *time.Time
    	unexported string // unexported value
    	CreatedAt  time.Time
    	UpdatedAt  time.Time
    }
    
    func TestNonStdPrimaryKeyAndDefaultValues(t *testing.T) {
    	DB.Migrator().DropTable(&Animal{})
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  5. utils/utils_test.go

    		{"error not equal", errors.New("1"), errors.New("2"), false},
    		{"driver.Valuer equal", ModifyAt{Time: now, Valid: true}, ModifyAt{Time: now, Valid: true}, true},
    		{"driver.Valuer not equal", ModifyAt{Time: now, Valid: true}, ModifyAt{Time: now.Add(time.Second), Valid: true}, false},
    		{"driver.Valuer equal (ptr to nil ptr)", (*ModifyAt)(nil), &ModifyAt{}, false},
    	}
    	for _, test := range assertEqualTests {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Feb 19 03:42:25 GMT 2024
    - 3.6K bytes
    - Viewed (0)
  6. tests/default_value_test.go

    import (
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    )
    
    func TestDefaultValue(t *testing.T) {
    	type Harumph struct {
    		gorm.Model
    		Email   string    `gorm:"not null;index:,unique"`
    		Name    string    `gorm:"notNull;default:foo"`
    		Name2   string    `gorm:"size:233;not null;default:'foo'"`
    		Name3   string    `gorm:"size:233;notNull;default:''"`
    		Age     int       `gorm:"default:18"`
    		Created time.Time `gorm:"default:2000-01-02"`
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 2.3K bytes
    - Viewed (0)
  7. gorm.go

    	}
    
    	if config.Logger == nil {
    		config.Logger = logger.Default
    	}
    
    	if config.NowFunc == nil {
    		config.NowFunc = func() time.Time { return time.Now().Local() }
    	}
    
    	if dialector != nil {
    		config.Dialector = dialector
    	}
    
    	if config.Plugins == nil {
    		config.Plugins = map[string]Plugin{}
    	}
    
    	if config.cacheStore == nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
  8. tests/query_test.go

    		}
    	}
    
    	var times []time.Time
    	if err := DB.Model(User{}).Where("name like ?", "pluck-user%").Pluck("created_at", &times).Error; err != nil {
    		t.Errorf("got error when pluck time: %v", err)
    	}
    
    	for idx, tv := range times {
    		AssertEqual(t, tv, users[idx].CreatedAt)
    	}
    
    	var ptrtimes []*time.Time
    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)
  9. tests/tests_test.go

    package tests_test
    
    import (
    	"log"
    	"math/rand"
    	"os"
    	"path/filepath"
    	"time"
    
    	"gorm.io/driver/mysql"
    	"gorm.io/driver/postgres"
    	"gorm.io/driver/sqlite"
    	"gorm.io/driver/sqlserver"
    	"gorm.io/gorm"
    	"gorm.io/gorm/logger"
    	. "gorm.io/gorm/utils/tests"
    )
    
    var DB *gorm.DB
    var (
    	mysqlDSN     = "gorm:gorm@tcp(localhost:9910)/gorm?charset=utf8&parseTime=True&loc=Local"
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 3.3K bytes
    - Viewed (1)
  10. tests/sql_builder_test.go

    	}
    
    	if DB.Dialector.Name() == "sqlserver" {
    		t.Skip("Skip SQL Server for this test, because it too difference with other dialects.")
    	}
    
    	date, _ := time.ParseInLocation("2006-01-02", "2021-10-18", time.Local)
    
    	// find
    	sql := DB.ToSQL(func(tx *gorm.DB) *gorm.DB {
    		return tx.Model(&User{}).Where("id = ?", 100).Limit(10).Order("age desc").Find(&[]User{})
    	})
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 16.7K bytes
    - Viewed (0)
Back to top