model

package
v0.24.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Transaction

type Transaction struct {
	weaver.AutoMarshal
	FromAccountNum string    `gorm:"column:from_acct;not null"`
	FromRoutingNum string    `gorm:"column:from_route;not null"`
	ToAccountNum   string    `gorm:"column:to_acct;not null"`
	ToRoutingNum   string    `gorm:"column:to_route;not null"`
	Amount         int64     `gorm:"column:amount;not null"`
	Timestamp      time.Time `gorm:"column:timestamp;not null"`
}

Transaction defines a banking transaction.

func (*Transaction) String

func (t *Transaction) String() string

func (*Transaction) WeaverMarshal

func (x *Transaction) WeaverMarshal(enc *codegen.Encoder)

func (*Transaction) WeaverUnmarshal

func (x *Transaction) WeaverUnmarshal(dec *codegen.Decoder)

type TransactionWithID

type TransactionWithID struct {
	weaver.AutoMarshal
	Transaction
	TransactionID int64 `gorm:"column:transaction_id;primaryKey;autoIncrement:true"`
}

TransactionWithID annotates model.Transaction with a unique TransactionID. This is used by readers of "transaction" table that require the transaction_id column in addition to the rest of transaction data.

Note: Ideally we'd like to have a single Transaction struct which would have the TransactionID field as well. However, that doesn't work well with gorm, since inserts sql statements generated by gorm always specify transaction_id as 0 (TransactionID's zero value), resulting in primary key conflicts.

func (*TransactionWithID) WeaverMarshal

func (x *TransactionWithID) WeaverMarshal(enc *codegen.Encoder)

func (*TransactionWithID) WeaverUnmarshal

func (x *TransactionWithID) WeaverUnmarshal(dec *codegen.Decoder)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL