21 lines
500 B
Go
21 lines
500 B
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type BankAccount struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
Label string `gorm:"unique;not null" json:"label"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
Transactions []Transaction `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"transactions"`
|
|
}
|
|
|
|
func NewBankAccount(label string) *BankAccount {
|
|
account := BankAccount{
|
|
Label: label,
|
|
}
|
|
|
|
return &account
|
|
}
|