Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for mellom (0.15 sec)

  1. tests/embedded_struct_test.go

    	}
    
    	DB.Migrator().DropTable(&HNPost{})
    	if err := DB.Migrator().AutoMigrate(&HNPost{}); err != nil {
    		t.Fatalf("failed to auto migrate, got error: %v", err)
    	}
    
    	hnPost := HNPost{Content: Content{Content: "hello world"}}
    
    	if err := DB.Create(&hnPost).Error; err != nil {
    		t.Errorf("Failed to create got error %v", err)
    	}
    }
    
    func TestEmbeddedRelations(t *testing.T) {
    	type EmbUser struct {
    		gorm.Model
    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)
  2. chainable_api.go

    )
    
    // Model specify the model you would like to run db operations
    //
    //	// update all users's name to `hello`
    //	db.Model(&User{}).Update("name", "hello")
    //	// if user's primary key is non-blank, will use it as condition, then will only update that user's name to `hello`
    //	db.Model(&user).Update("name", "hello")
    func (db *DB) Model(value interface{}) (tx *DB) {
    	tx = db.getInstance()
    	tx.Statement.Model = value
    	return
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  3. tests/postgres_test.go

    		t.Fatalf("Failed to create 'uuid-ossp' extension, but got error %v", err)
    	}
    
    	DB.Migrator().DropTable(&Post{}, &Category{}, "post_categories")
    	DB.AutoMigrate(&Post{}, &Category{})
    
    	post := Post{
    		Title: "Hello World",
    		Categories: []*Category{
    			{Title: "Coding"},
    			{Title: "Golang"},
    		},
    	}
    
    	if err := DB.Create(&post).Error; err != nil {
    		t.Errorf("Failed, got error: %v", err)
    	}
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Oct 08 09:16:32 GMT 2022
    - 6.4K bytes
    - Viewed (3)
  4. logger/logger.go

    		errStr = Magenta + "%s\n" + Reset + Red + "[error] " + Reset
    		traceStr = Green + "%s\n" + Reset + Yellow + "[%.3fms] " + BlueBold + "[rows:%v]" + Reset + " %s"
    		traceWarnStr = Green + "%s " + Yellow + "%s\n" + Reset + RedBold + "[%.3fms] " + Yellow + "[rows:%v]" + Magenta + " %s" + Reset
    		traceErrStr = RedBold + "%s " + MagentaBold + "%s\n" + Reset + Yellow + "[%.3fms] " + BlueBold + "[rows:%v]" + Reset + " %s"
    	}
    
    	return &logger{
    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)
  5. schema/index_test.go

    	Name4        string `gorm:"uniqueIndex"`
    	Name5        int64  `gorm:"index:,class:FULLTEXT,comment:hello \\, world,where:age > 10"`
    	Name6        int64  `gorm:"index:profile,comment:hello \\, world,where:age > 10"`
    	Age          int64  `gorm:"index:profile,expression:ABS(age),option:WITH PARSER parser_name"`
    	OID          int64  `gorm:"index:idx_id;index:idx_oid,unique"`
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
  6. tests/serializer_test.go

    		*es = EncryptedString(bytes.TrimPrefix(value, []byte("hello")))
    	case string:
    		*es = EncryptedString(strings.TrimPrefix(value, "hello"))
    	default:
    		return fmt.Errorf("unsupported data %#v", dbValue)
    	}
    	return nil
    }
    
    func (es EncryptedString) Value(ctx context.Context, field *schema.Field, dst reflect.Value, fieldValue interface{}) (interface{}, error) {
    	return "hello" + string(es), nil
    }
    
    type CustomSerializer struct {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 21 14:09:38 GMT 2023
    - 7.6K bytes
    - Viewed (0)
  7. tests/default_value_test.go

    		Age     int       `gorm:"default:18"`
    		Created time.Time `gorm:"default:2000-01-02"`
    		Enabled bool      `gorm:"default:true"`
    	}
    
    	harumph2 := Harumph2{ID: 2, Email: "hello2@gorm.io"}
    	if err := DB.Table("harumphs").Create(&harumph2).Error; err != nil {
    		t.Fatalf("Failed to create data with default value, got error: %v", err)
    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)
Back to top