MCPcopy
hub / github.com/go-gorm/gorm / TestGaussDBMany2ManyWithDefaultValueUUID

Function TestGaussDBMany2ManyWithDefaultValueUUID

tests/gaussdb_test.go:160–184  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

158}
159
160func TestGaussDBMany2ManyWithDefaultValueUUID(t *testing.T) {
161 t.Skipf("This test case skipped, because of gaussdb does not have 'uuid-ossp' extension")
162 if DB.Dialector.Name() != "gaussdb" {
163 t.Skip()
164 }
165
166 if err := DB.Exec(`create extension if not exists "uuid-ossp"`).Error; err != nil {
167 t.Fatalf("Failed to create 'uuid-ossp' extension, but got error %v", err)
168 }
169
170 DB.Migrator().DropTable(&Post{}, &Category{}, "post_categories")
171 DB.AutoMigrate(&Post{}, &Category{})
172
173 post := Post{
174 Title: "Hello World",
175 Categories: []*Category{
176 {Title: "Coding"},
177 {Title: "Golang"},
178 },
179 }
180
181 if err := DB.Create(&post).Error; err != nil {
182 t.Errorf("Failed, got error: %v", err)
183 }
184}
185
186func TestGaussDBOnConstraint(t *testing.T) {
187 t.Skipf("This test case skipped, because of gaussdb not support 'ON CONSTRAINT' statement")

Callers

nothing calls this directly

Calls 6

NameMethod · 0.65
ExecMethod · 0.65
DropTableMethod · 0.65
MigratorMethod · 0.65
AutoMigrateMethod · 0.65
CreateMethod · 0.65

Tested by

no test coverage detected