Documentation ¶
Index ¶
- func InitTables(db *egorm.Component) error
- type Payment
- type PaymentDAO
- type PaymentGORMDAO
- func (g *PaymentGORMDAO) CountTimeoutPayments(ctx context.Context, ctime int64) (int64, error)
- func (g *PaymentGORMDAO) FindOrCreate(ctx context.Context, pmt Payment, records []PaymentRecord) (Payment, []PaymentRecord, error)
- func (g *PaymentGORMDAO) FindPaymentByID(ctx context.Context, pmtID int64) (Payment, []PaymentRecord, error)
- func (g *PaymentGORMDAO) FindPaymentByOrderSN(ctx context.Context, orderSN string) (Payment, []PaymentRecord, error)
- func (g *PaymentGORMDAO) FindTimeoutPayments(ctx context.Context, offset int, limit int, ctime int64) ([]Payment, error)
- func (g *PaymentGORMDAO) UpdateByOrderSN(ctx context.Context, pmt Payment, records []PaymentRecord) error
- type PaymentRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitTables ¶
Types ¶
type Payment ¶
type Payment struct { Id int64 `gorm:"primaryKey;autoIncrement;comment:支付自增ID"` SN string `gorm:"type:varchar(255);not null;uniqueIndex:uniq_payment_sn;comment:支付序列号"` PayerId int64 `gorm:"index:idx_payer_id;comment:支付者ID"` OrderId int64 `gorm:"uniqueIndex:uniq_order_id;comment:订单自增ID,冗余允许为NULL"` OrderSn sql.NullString `gorm:"type:varchar(255);uniqueIndex:uniq_order_sn;comment:订单序列号,冗余允许为NULL"` OrderDescription string `gorm:"type:varchar(255);not null;comment:订单简要描述"` TotalAmount int64 `gorm:"not null;comment:支付总金额, 多种支付方式支付金额的总和"` PaidAt int64 `gorm:"comment:支付时间"` Status uint8 `gorm:"type:tinyint unsigned;not null;default:1;comment:支付状态 1=未支付 2=已支付 3=已失败"` Ctime int64 Utime int64 }
type PaymentDAO ¶
type PaymentDAO interface { FindOrCreate(ctx context.Context, pmt Payment, records []PaymentRecord) (Payment, []PaymentRecord, error) FindPaymentByID(ctx context.Context, pmtID int64) (Payment, []PaymentRecord, error) UpdateByOrderSN(ctx context.Context, pmt Payment, records []PaymentRecord) error FindPaymentByOrderSN(ctx context.Context, orderSN string) (Payment, []PaymentRecord, error) FindTimeoutPayments(ctx context.Context, offset int, limit int, ctime int64) ([]Payment, error) CountTimeoutPayments(ctx context.Context, ctime int64) (int64, error) }
func NewPaymentGORMDAO ¶ added in v0.1.0
func NewPaymentGORMDAO(db *gorm.DB) PaymentDAO
type PaymentGORMDAO ¶ added in v0.1.0
type PaymentGORMDAO struct {
// contains filtered or unexported fields
}
func (*PaymentGORMDAO) CountTimeoutPayments ¶ added in v0.1.0
func (*PaymentGORMDAO) FindOrCreate ¶ added in v0.1.0
func (g *PaymentGORMDAO) FindOrCreate(ctx context.Context, pmt Payment, records []PaymentRecord) (Payment, []PaymentRecord, error)
func (*PaymentGORMDAO) FindPaymentByID ¶ added in v0.1.0
func (g *PaymentGORMDAO) FindPaymentByID(ctx context.Context, pmtID int64) (Payment, []PaymentRecord, error)
func (*PaymentGORMDAO) FindPaymentByOrderSN ¶ added in v0.1.0
func (g *PaymentGORMDAO) FindPaymentByOrderSN(ctx context.Context, orderSN string) (Payment, []PaymentRecord, error)
func (*PaymentGORMDAO) FindTimeoutPayments ¶ added in v0.1.0
func (*PaymentGORMDAO) UpdateByOrderSN ¶ added in v0.1.0
func (g *PaymentGORMDAO) UpdateByOrderSN(ctx context.Context, pmt Payment, records []PaymentRecord) error
type PaymentRecord ¶
type PaymentRecord struct { Id int64 `gorm:"primaryKey;autoIncrement;comment:支付记录自增ID"` PaymentId int64 `gorm:"not null;uniqueIndex:unq_idx_payment_id_channel;comment:支付自增ID"` PaymentNO3rd sql.NullString `gorm:"column:payment_no_3rd;type:varchar(255);uniqueIndex:uniq_payment_no_3rd;comment:支付单号, 支付渠道的事务ID"` Description string `gorm:"type:varchar(255);not null;comment:本次支付的简要描述"` Channel uint8 `` /* 126-byte string literal not displayed */ Amount int64 `gorm:"not null;comment:支付金额"` PaidAt int64 `gorm:"comment:支付时间"` Status uint8 `gorm:"type:tinyint unsigned;not null;default:1;comment:支付状态 1=未支付 2=处理中 3=支付成功 4=支付失败"` Ctime int64 Utime int64 }
Click to show internal directories.
Click to hide internal directories.