- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 81 for Model (0.18 sec)
-
model.go
package gorm import "time" // Model a basic GoLang struct which includes the following fields: ID, CreatedAt, UpdatedAt, DeletedAt // It may be embedded into your model or you may build your own model without it // // type User struct { // gorm.Model // } type Model struct { ID uint `gorm:"primarykey"` CreatedAt time.Time UpdatedAt time.Time DeletedAt DeletedAt `gorm:"index"`
Go - Registered: Sun Mar 24 09:35:10 GMT 2024 - Last Modified: Sat Feb 18 01:06:43 GMT 2023 - 396 bytes - Viewed (0) -
schema/model_test.go
package schema_test import ( "database/sql" "time" "gorm.io/gorm" "gorm.io/gorm/utils/tests" ) type User struct { *gorm.Model Name *string Age *uint Birthday *time.Time Account *tests.Account Pets []*tests.Pet Toys []*tests.Toy `gorm:"polymorphic:Owner"` CompanyID *int Company *tests.Company ManagerID *uint Manager *User
Go - Registered: Sun Mar 24 09:35:10 GMT 2024 - Last Modified: Thu Jan 06 07:02:53 GMT 2022 - 1.1K bytes - Viewed (0) -
tests/associations_many2many_test.go
// Find var user2 User DB.Find(&user2, "id = ?", user.ID) DB.Model(&user2).Association("Languages").Find(&user2.Languages) CheckUser(t, user2, user) // Count AssertAssociationCount(t, user, "Languages", 2, "") // Append language := Language{Code: "language-many2many-append", Name: "language-many2many-append"} DB.Create(&language) if err := DB.Model(&user2).Association("Languages").Append(&language); err != nil {
Go - Registered: Sun Mar 24 09:35:10 GMT 2024 - Last Modified: Sat Jun 10 13:05:19 GMT 2023 - 13.2K bytes - Viewed (0) -
tests/associations_test.go
var emptyUser User var err error // belongs to err = DB.Model(&emptyUser).Association("Company").Delete(&user1.Company) AssertEqual(t, err, gorm.ErrPrimaryKeyRequired) // has many err = DB.Model(&emptyUser).Association("Pets").Delete(&user1.Pets) AssertEqual(t, err, gorm.ErrPrimaryKeyRequired) // has one err = DB.Model(&emptyUser).Association("Account").Delete(&user1.Account)
Go - Registered: Sun Mar 24 09:35:10 GMT 2024 - Last Modified: Wed Feb 08 08:29:09 GMT 2023 - 10.9K bytes - Viewed (0) -
association.go
Go - Registered: Sun Mar 24 09:35:10 GMT 2024 - Last Modified: Thu May 04 11:30:45 GMT 2023 - 21.2K bytes - Viewed (0) -
tests/sql_builder_test.go
dryRunDB := DB.Session(&gorm.Session{DryRun: true}) stmt := dryRunDB.Model(&user).Where("id = ?", 1).Updates(map[string]interface{}{"age": ageInt(8)}).Statement sql := DB.Dialector.Explain(stmt.SQL.String(), stmt.Vars...) if !regexp.MustCompile(`.*age.*=8,`).MatchString(sql) { t.Errorf("Failed to generate sql, got %v", sql) }
Go - Registered: Sun Mar 24 09:35:10 GMT 2024 - Last Modified: Fri Jan 12 08:42:21 GMT 2024 - 16.7K bytes - Viewed (0) -
istioctl/pkg/writer/envoy/configdump/cluster.go
"istio.io/istio/istioctl/pkg/util/proto" "istio.io/istio/pilot/pkg/model" v3 "istio.io/istio/pilot/pkg/xds/v3" "istio.io/istio/pkg/config/host" ) // ClusterFilter is used to pass filter information into cluster based config writer print functions type ClusterFilter struct { FQDN host.Name Port int Subset string Direction model.TrafficDirection }
Go - Registered: Wed Mar 27 22:53:09 GMT 2024 - Last Modified: Thu May 11 05:38:17 GMT 2023 - 5.9K bytes - Viewed (0) -
tests/query_test.go
var simpleUser2 SimpleUser if err := DB.Model(&User{}).Select("id").First(&simpleUser2, user.ID).Error; err != nil { t.Fatalf("Failed to query smaller user, got error %v", err) } AssertObjEqual(t, user, simpleUser2, "ID") var simpleUsers []SimpleUser if err := DB.Model(&User{}).Select("id").Find(&simpleUsers, user.ID).Error; err != nil || len(simpleUsers) != 1 {
Go - Registered: Sun Mar 24 09:35:10 GMT 2024 - Last Modified: Fri Mar 15 06:14:48 GMT 2024 - 49.4K bytes - Viewed (0) -
tests/named_polymorphic_test.go
} if DB.Model(&hamster2).Association("OtherToy").Count() != 1 { t.Errorf("Hamster's toys count should be 1 after Append") } // Replace DB.Model(&hamster).Association("PreferredToy").Replace(&Toy{ Name: "bike 3", }) DB.Model(&hamster).Association("OtherToy").Replace(&Toy{ Name: "treadmill 3", }) hamsterToy = Toy{}
Go - Registered: Sun Mar 24 09:35:10 GMT 2024 - Last Modified: Wed Jul 08 09:59:40 GMT 2020 - 4.2K bytes - Viewed (0) -
tests/multi_primary_keys_test.go
DB.Model(&blog).Association("Tags").Delete(tag5) var tags3 []Tag DB.Model(&blog).Association("Tags").Find(&tags3) if !compareTags(tags3, []string{"tag6"}) { t.Fatalf("Should find 1 tags after Delete") } if DB.Model(&blog).Association("Tags").Count() != 1 { t.Fatalf("Blog should has three tags after Delete") } DB.Model(&blog).Association("Tags").Delete(tag3) var tags4 []Tag
Go - Registered: Sun Mar 24 09:35:10 GMT 2024 - Last Modified: Thu Jan 06 07:02:53 GMT 2022 - 12.8K bytes - Viewed (0)