Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type Account struct {
- ID *uint `gorm:"primaryKey"`
- UserID *uint `gorm:"not null"`
- Name *string `gorm:"not null"`
- Balance *float64 `gorm:"not null"`
- CreatedAt *time.Time `gorm:"autoCreateTime"`
- UpdatedAt *time.Time `gorm:"autoUpdateTime"`
- DeletedAt *gorm.DeletedAt `gorm:"index"`
- Finance *[]Finance
- }
- type Transaction struct {
- ID *uint `gorm:"primaryKey"`
- UserID *uint `gorm:"not null"`
- EmitterID *uint `gorm:"not null"`
- BeneficiaryID *uint `gorm:"not null"`
- Value *float64 `gorm:"not null"`
- CreatedAt *time.Time `gorm:"autoCreateTime"`
- UpdatedAt *time.Time `gorm:"autoUpdateTime"`
- DeletedAt *gorm.DeletedAt `gorm:"index"`
- Emitter *Account `gorm:"foreignKey:EmitterID"`
- Beneficiary *Account `gorm:"foreignKey:BeneficiaryID"`
- }
- // var transactions []*Transaction
- // *gorm.DB.Preload("Emitter").Preload("Beneficiary").Find(&transactions)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement