Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for Post (0.14 sec)

  1. tests/embedded_struct_test.go

    		t.Fatalf("no error should happen when query with embedded struct, but got %v", err)
    	}
    	expectAuthors := []string{"Edward", "George"}
    	for i, post := range egPosts {
    		t.Log(i, post.Author)
    		if want := expectAuthors[i]; post.Author.Name != want {
    			t.Errorf("expected author %s got %s", want, post.Author.Name)
    		}
    	}
    }
    
    func TestEmbeddedPointerTypeStruct(t *testing.T) {
    	type BasePost struct {
    		Id    int64
    		Title string
    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. tests/postgres_test.go

    	}
    
    	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)
  3. tests/tests_test.go

    	. "gorm.io/gorm/utils/tests"
    )
    
    var DB *gorm.DB
    var (
    	mysqlDSN     = "gorm:gorm@tcp(localhost:9910)/gorm?charset=utf8&parseTime=True&loc=Local"
    	postgresDSN  = "user=gorm password=gorm dbname=gorm host=localhost port=9920 sslmode=disable TimeZone=Asia/Shanghai"
    	sqlserverDSN = "sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm"
    	tidbDSN      = "root:@tcp(localhost:9940)/test?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)
Back to top