Documentation
¶
Index ¶
- Variables
- func CreateTestDB(ctx context.Context, dialect databasepb.DatabaseDialect, statements ...string) (dsn string, cleanup func(), err error)
- func InitIntegrationTests() (cleanup func(), err error)
- func RunsOnEmulator() bool
- type Account
- type Child
- type Company
- type Config
- type Coupon
- type CouponProduct
- type Language
- type Order
- type Parent
- type Pet
- type Toy
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var Skipped bool
Functions ¶
func CreateTestDB ¶
func CreateTestDB(ctx context.Context, dialect databasepb.DatabaseDialect, statements ...string) (dsn string, cleanup func(), err error)
func InitIntegrationTests ¶
func InitIntegrationTests() (cleanup func(), err error)
func RunsOnEmulator ¶
func RunsOnEmulator() bool
Types ¶
type Coupon ¶
type Coupon struct {
ID int `gorm:"primarykey"`
AppliesToProduct []*CouponProduct `gorm:"foreignKey:CouponId;constraint:OnDelete:CASCADE"`
AmountOff int64 `gorm:"column:amount_off"`
PercentOff float64 `gorm:"column:percent_off"`
}
type CouponProduct ¶
type User ¶
type User struct {
gorm.Model
Name string
Age int64
Birthday *time.Time
Account Account
Pets []*Pet
NamedPet *Pet
Toys []Toy `gorm:"polymorphic:Owner"`
CompanyID sql.NullInt64
Company Company
ManagerID sql.NullInt64
Manager *User
Team []User `gorm:"foreignkey:ManagerID"`
Languages []Language `gorm:"many2many:UserSpeak;"`
Friends []*User `gorm:"many2many:user_friends;"`
Active bool
}
User has one `Account` (has one), many `Pets` (has many) and `Toys` (has many - polymorphic) He works in a Company (belongs to), he has a Manager (belongs to - single-table), and also managed a Team (has many - single-table) He speaks many languages (many to many) and has many friends (many to many - single-table) His pet also has one Toy (has one - polymorphic) NamedPet is a reference to a named `Pet` (has one)
Click to show internal directories.
Click to hide internal directories.