Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CreateAccountAndLedger = gormigrate.Migration{ ID: "2024-09-17:create-accounts-and-ledgers", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&Account{}, &Ledger{}) }, Rollback: func(tx *gorm.DB) error { return tx.Migrator().DropTable(&Ledger{}, &Account{}) }, }
CreateAccountAndLedger defines the migration, which creates the accounts and ledgers.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { ID string `gorm:"type:uuid;primary_key;default:uuid_generate_v4()"` CreatedAt time.Time UpdatedAt time.Time Name string `gorm:"type:varchar(255);not null"` Status string `gorm:"type:varchar(20);not null"` Currency string `gorm:"type:varchar(3);not null"` Balance decimal.Decimal `gorm:"type:decimal(20,2);not null"` Ledgers []Ledger }
Account represents the database model for an account
type Ledger ¶
type Ledger struct { ID string `gorm:"type:uuid;primary_key;default:uuid_generate_v4()"` CreatedAt time.Time UpdatedAt time.Time AccountID string `gorm:"type:uuid;not null"` Date time.Time `gorm:"not null"` Type string `gorm:"type:varchar(20);not null"` Amount decimal.Decimal `gorm:"type:decimal(20,2);not null"` Note string `gorm:"type:text"` IsAdjustment bool `gorm:"not null"` AdjustedFrom *string `gorm:"type:uuid"` IsVoided bool `gorm:"not null"` VoidedAt *time.Time }
Ledger represents the database model for a ledger entry
Click to show internal directories.
Click to hide internal directories.