Documentation ¶
Index ¶
- func AssertEqual(t *testing.T, got, expect interface{})
- func AssertObjEqual(t *testing.T, r, e interface{}, names ...string)
- func CheckBuildClauses(t *testing.T, clauses []clause.Interface, results []string, ...)
- func Now() *time.Time
- type Account
- type Company
- type DummyDialector
- func (DummyDialector) BindVarTo(writer clause.Writer, stmt *gorm.Statement, v interface{})
- func (DummyDialector) DataTypeOf(*schema.Field) string
- func (DummyDialector) DefaultValueOf(field *schema.Field) clause.Expression
- func (DummyDialector) Explain(sql string, vars ...interface{}) string
- func (DummyDialector) Initialize(*gorm.DB) error
- func (DummyDialector) Migrator(*gorm.DB) gorm.Migrator
- func (DummyDialector) Name() string
- func (DummyDialector) QuoteTo(writer clause.Writer, str string)
- type Language
- type Pet
- type Toy
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertEqual ¶
func AssertObjEqual ¶
func CheckBuildClauses ¶
Types ¶
type DummyDialector ¶
type DummyDialector struct { }
func (DummyDialector) BindVarTo ¶
func (DummyDialector) BindVarTo(writer clause.Writer, stmt *gorm.Statement, v interface{})
func (DummyDialector) DataTypeOf ¶
func (DummyDialector) DataTypeOf(*schema.Field) string
func (DummyDialector) DefaultValueOf ¶
func (DummyDialector) DefaultValueOf(field *schema.Field) clause.Expression
func (DummyDialector) Explain ¶
func (DummyDialector) Explain(sql string, vars ...interface{}) string
func (DummyDialector) Initialize ¶
func (DummyDialector) Initialize(*gorm.DB) error
func (DummyDialector) Name ¶
func (DummyDialector) Name() string
type User ¶
type User struct { gorm.Model Name string Age uint Birthday *time.Time Account Account Pets []*Pet Toys []Toy `gorm:"polymorphic:Owner"` CompanyID *int Company Company ManagerID *uint 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)
Click to show internal directories.
Click to hide internal directories.