Documentation
¶
Index ¶
- Variables
- func NameIn(names []string) func(d *DBCon) *DBCon
- func NameIn1And2(d *DBCon) *DBCon
- func NameIn2And3(d *DBCon) *DBCon
- type Address
- type Animal
- type Author
- type BasePost
- type BigEmail
- type Blog
- type CalculateField
- type CalculateFieldCategory
- type CalculateFieldChild
- type Cart
- type Cat
- type Category
- type Comment
- type Company
- type CreditCard
- type CustomColumnAndIgnoredFieldClash
- type CustomizeAccount
- type CustomizeColumn
- type CustomizeInvitation
- type CustomizePerson
- type CustomizeUser
- type Dog
- type ElementWithIgnoredField
- type Email
- type EmbeddedField
- type EngadgetPost
- type ExampleStringSlice
- type ExampleStruct
- type ExampleStructSlice
- type HNPost
- type Hamster
- type JoinTable
- type Language
- type LevelA1
- type LevelA2
- type LevelA3
- type LevelB1
- type LevelB2
- type LevelB3
- type LevelC1
- type LevelC2
- type LevelC3
- type MultipleIndexes
- type NormalStruct
- type NotSoLongTableName
- type NullTime
- type NullValue
- type Num
- type Order
- type Person
- type PersonAddress
- type PointerStruct
- type Post
- type Product
- func (s *Product) AfterCreate(tx *DBCon)
- func (s *Product) AfterDelete() (err error)
- func (s *Product) AfterFind()
- func (s *Product) AfterSave() (err error)
- func (s *Product) AfterUpdate()
- func (s *Product) BeforeCreate() (err error)
- func (s *Product) BeforeDelete() (err error)
- func (s *Product) BeforeSave() (err error)
- func (s *Product) BeforeUpdate() (err error)
- func (s *Product) GetCallTimes() []int64
- type PromotionBenefit
- type PromotionCoupon
- type PromotionDiscount
- type PromotionRule
- type ReallyLongTableNameToTestMySQLNameLengthLimit
- type ReallyLongThingThatReferencesShort
- type RecordWithSlice
- type Role
- type Short
- type Tag
- type Toy
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TestDB *DBCon TestDBErr error )
Functions ¶
func NameIn1And2 ¶
func NameIn1And2(d *DBCon) *DBCon
func NameIn2And3 ¶
func NameIn2And3(d *DBCon) *DBCon
Types ¶
type BigEmail ¶
type CalculateField ¶
type CalculateField struct {
Model
Name string
Children []CalculateFieldChild
Category CalculateFieldCategory
EmbeddedField
}
type CalculateFieldCategory ¶
type CalculateFieldChild ¶
type CreditCard ¶
type CustomColumnAndIgnoredFieldClash ¶
type CustomColumnAndIgnoredFieldClash struct {
Body string `sql:"-"`
RawBody string `gorm:"column:body"`
}
Make sure an ignored field does not interfere with another field's custom column name that matches the ignored field.
type CustomizeAccount ¶
type CustomizeColumn ¶
type CustomizeInvitation ¶
type CustomizeInvitation struct {
Model
Address string `sql:"column:invitation"`
Person *CustomizeUser `gorm:"foreignkey:Email;associationforeignkey:invitation"`
}
type CustomizePerson ¶
type CustomizePerson struct {
IdPerson string `gorm:"column:idPerson;primary_key:true"`
Accounts []CustomizeAccount `gorm:"many2many:PersonAccount;associationforeignkey:idAccount;foreignkey:idPerson"`
}
type CustomizeUser ¶
type CustomizeUser struct {
Model
Email string `sql:"column:email_address"`
}
type ElementWithIgnoredField ¶
func (ElementWithIgnoredField) TableName ¶
func (e ElementWithIgnoredField) TableName() string
type EmbeddedField ¶
type EmbeddedField struct {
EmbeddedName string `sql:"NOT NULL;DEFAULT:'hello'"`
}
type EngadgetPost ¶
type ExampleStringSlice ¶
type ExampleStringSlice []string
func (*ExampleStringSlice) Scan ¶
func (l *ExampleStringSlice) Scan(input interface{}) error
type ExampleStruct ¶
type ExampleStructSlice ¶
type ExampleStructSlice []ExampleStruct
func (*ExampleStructSlice) Scan ¶
func (l *ExampleStructSlice) Scan(input interface{}) error
type MultipleIndexes ¶
type MultipleIndexes struct {
ID int64
UserID int64 `sql:"unique_index:uix_multipleindexes_user_name,uix_multipleindexes_user_email;index:idx_multipleindexes_user_other"`
Name string `sql:"unique_index:uix_multipleindexes_user_name"`
Email string `sql:"unique_index:,uix_multipleindexes_user_email"`
Other string `sql:"index:,idx_multipleindexes_user_other"`
}
type NormalStruct ¶
type NotSoLongTableName ¶
type NotSoLongTableName struct {
Id int64
ReallyLongThingID int64
ReallyLongThing ReallyLongTableNameToTestMySQLNameLengthLimit
}
type NullValue ¶
type NullValue struct {
Id int64
Name sql.NullString `sql:"not null"`
Gender *sql.NullString `sql:"not null"`
Age sql.NullInt64
Male sql.NullBool
Height sql.NullFloat64
AddedAt NullTime
}
Scanner
type PersonAddress ¶
type PersonAddress struct {
JoinTableHandler
PersonID int
AddressID int
DeletedAt *time.Time
CreatedAt time.Time
}
func (*PersonAddress) Add ¶
func (*PersonAddress) Add(handler JoinTableHandlerInterface, db *DBCon, foreignValue interface{}, associationValue interface{}) error
func (*PersonAddress) Delete ¶
func (*PersonAddress) Delete(handler JoinTableHandlerInterface, db *DBCon) error
func (*PersonAddress) JoinWith ¶
func (pa *PersonAddress) JoinWith(handler JoinTableHandlerInterface, db *DBCon, source interface{}) *DBCon
type PointerStruct ¶
type Product ¶
type Product struct {
Id int64
Code string
Price int64
CreatedAt time.Time
UpdatedAt time.Time
AfterFindCallTimes int64
BeforeCreateCallTimes int64
AfterCreateCallTimes int64
BeforeUpdateCallTimes int64
AfterUpdateCallTimes int64
BeforeSaveCallTimes int64
AfterSaveCallTimes int64
BeforeDeleteCallTimes int64
AfterDeleteCallTimes int64
}
func (*Product) AfterCreate ¶
func (s *Product) AfterCreate(tx *DBCon)
func (*Product) AfterDelete ¶
func (*Product) AfterUpdate ¶
func (s *Product) AfterUpdate()
func (*Product) BeforeCreate ¶
func (*Product) BeforeDelete ¶
func (*Product) BeforeSave ¶
func (*Product) BeforeUpdate ¶
func (*Product) GetCallTimes ¶
type PromotionBenefit ¶
type PromotionBenefit struct {
Model
Name string
PromotionID uint
Discount PromotionDiscount `gorm:"ForeignKey:promotion_id"`
}
type PromotionCoupon ¶
type PromotionCoupon struct {
Model
Code string
DiscountID uint
Discount PromotionDiscount
}
type PromotionDiscount ¶
type PromotionDiscount struct {
Model
Name string
Coupons []*PromotionCoupon `gorm:"ForeignKey:discount_id"`
Rule *PromotionRule `gorm:"ForeignKey:discount_id"`
Benefits []PromotionBenefit `gorm:"ForeignKey:promotion_id"`
}
type PromotionRule ¶
type ReallyLongTableNameToTestMySQLNameLengthLimit ¶
type ReallyLongTableNameToTestMySQLNameLengthLimit struct {
Id int64
}
type RecordWithSlice ¶
type RecordWithSlice struct {
ID uint64
Strings ExampleStringSlice `sql:"type:text"`
Structs ExampleStructSlice `sql:"type:text"`
}
type User ¶
type User struct {
Id int64
Age int64
UserNum Num
Name string `sql:"size:255"`
Email string
Birthday *time.Time // Time
CreatedAt time.Time // CreatedAt: Time of record is created, will be insert automatically
UpdatedAt time.Time // UpdatedAt: Time of record is updated, will be updated automatically
Emails []Email // Embedded structs
BillingAddress Address // Embedded struct
BillingAddressID sql.NullInt64 // Embedded struct's foreign key
ShippingAddress Address // Embedded struct
ShippingAddressId int64 // Embedded struct's foreign key
CreditCard CreditCard
Latitude float64
Languages []Language `gorm:"many2many:user_languages;"`
CompanyID *int
Company Company
Role
PasswordHash []byte
Sequence uint `gorm:"AUTO_INCREMENT"`
IgnoreMe int64 `sql:"-"`
IgnoreStringSlice []string `sql:"-"`
Ignored struct{ Name string } `sql:"-"`
IgnoredPointer *User `sql:"-"`
}
Click to show internal directories.
Click to hide internal directories.