budget-go/database/model/bank_account.go
2024-09-18 00:22:48 +02:00

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
}