Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 22 for nulla (0.19 sec)

  1. tests/migrate_test.go

    		// sqlserver driver treats NULL and 'NULL' the same
    		t.Skip("skip sqlserver")
    	}
    
    	type NullModel struct {
    		ID      uint
    		Content string `gorm:"default:null"`
    	}
    
    	type NullStringModel struct {
    		ID      uint
    		Content string `gorm:"default:'null'"`
    		Active  bool   `gorm:"default:false"`
    	}
    
    	tableName := "null_string_model"
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  2. tests/gorm_test.go

    		// these dialects do not support the "returning" clause
    		return
    	default:
    		// This user struct will leverage the existing users table, but override
    		// the Name field to default to null.
    		type user struct {
    			gorm.Model
    			Name string `gorm:"default:null"`
    		}
    		u1 := user{}
    
    		if results := DB.Create(&u1); results.Error != nil {
    			t.Fatalf("errors happened on create: %v", results.Error)
    		} else if results.RowsAffected != 1 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jun 01 07:22:21 GMT 2023
    - 3.3K bytes
    - Viewed (0)
  3. callbacks/create.go

    						if v, ok := selectColumns[field.DBName]; (ok && v) || (!ok && !restricted) {
    							if !field.PrimaryKey && (!field.HasDefaultValue || field.DefaultValueInterface != nil ||
    								strings.EqualFold(field.DefaultValue, "NULL")) && field.AutoCreateTime == 0 {
    								if field.AutoUpdateTime > 0 {
    									assignment := clause.Assignment{Column: clause.Column{Name: field.DBName}, Value: curTime}
    									switch field.AutoUpdateTime {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  4. finisher_api.go

    // value includes a deleted_at field, then Delete performs a soft delete instead by setting deleted_at with the current
    // time if null.
    func (db *DB) Delete(value interface{}, conds ...interface{}) (tx *DB) {
    	tx = db.getInstance()
    	if len(conds) > 0 {
    		if exprs := tx.Statement.BuildCondition(conds[0], conds[1:]...); len(exprs) > 0 {
    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)
  5. tests/update_test.go

    	}
    
    	dryDB := DB.Session(&gorm.Session{DryRun: true})
    	stmt := dryDB.Save(&user).Statement
    	if !regexp.MustCompile(`.users.\..deleted_at. IS NULL`).MatchString(stmt.SQL.String()) {
    		t.Fatalf("invalid updating SQL, got %v", stmt.SQL.String())
    	}
    
    	dryDB = DB.Session(&gorm.Session{DryRun: true})
    	stmt = dryDB.Unscoped().Save(&user).Statement
    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)
  6. tests/associations_belongs_to_test.go

    }
    
    func TestBelongsToDefaultValue(t *testing.T) {
    	type Org struct {
    		ID string
    	}
    	type BelongsToUser struct {
    		OrgID string
    		Org   Org `gorm:"default:NULL"`
    	}
    
    	tx := DB.Session(&gorm.Session{})
    	tx.Config.DisableForeignKeyConstraintWhenMigrating = true
    	AssertEqual(t, DB.Config.DisableForeignKeyConstraintWhenMigrating, false)
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 9.3K bytes
    - Viewed (0)
  7. statement.go

    			stmt.DB.Dialector.BindVarTo(writer, stmt, v)
    		case []interface{}:
    			if len(v) > 0 {
    				writer.WriteByte('(')
    				stmt.AddVar(writer, v...)
    				writer.WriteByte(')')
    			} else {
    				writer.WriteString("(NULL)")
    			}
    		case *DB:
    			subdb := v.Session(&Session{Logger: logger.Discard, DryRun: true}).getInstance()
    			if v.Statement.SQL.Len() > 0 {
    				var (
    					vars = subdb.Statement.Vars
    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. tests/sql_builder_test.go

    	})
    	assertEqualSQL(t, `INSERT INTO "users" ("created_at","updated_at","deleted_at","name","age","birthday","company_id","manager_id","active") VALUES ('2021-10-18 00:00:00','2021-10-18 00:00:00',NULL,'foo',20,NULL,NULL,NULL,false) RETURNING "id"`, sql)
    
    	// save
    	user = &User{Name: "foo", Age: 20}
    	user.CreatedAt = date
    	user.UpdatedAt = date
    	sql = DB.ToSQL(func(tx *gorm.DB) *gorm.DB {
    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)
  9. 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)
  10. tests/query_test.go

    	}
    
    	type QueryResetNullValue struct {
    		ID      int
    		Name    string     `gorm:"default:NULL"`
    		Flag    bool       `gorm:"default:NULL"`
    		Number1 int64      `gorm:"default:NULL"`
    		Number2 uint64     `gorm:"default:NULL"`
    		Number3 float64    `gorm:"default:NULL"`
    		Now     *time.Time `gorm:"defalut:NULL"`
    		Item1Id string
    		Item1   *QueryResetItem `gorm:"references:ID"`
    		Item2Id string
    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)
Back to top