cmb

package
v2.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CardMode

type CardMode string
const (
	CardModeDebit   CardMode = "Debit"
	CardModeCredit  CardMode = "Credit"
	CardModeUnknown CardMode = "Unknown"
)

type Cmb

type Cmb struct {
	Statistics       Statistics    `json:"statistics,omitempty"`
	LineNum          int           `json:"line_num,omitempty"`
	Mode             CardMode      `json:"mode,omitempty"`
	DebitOrders      []DebitOrder  `json:"debit_orders,omitempty"`
	CreditOrders     []CreditOrder `json:"credit_orders,omitempty"`
	DebitRealHeaders []string      `json:"debit_real_headers,omitempty"`
	CreditBillYear   string        `json:"credit_bill_year,omitempty"`
	CreditBillMonth  string        `json:"credit_bill_month,omitempty"`
}

func New

func New() *Cmb

func (*Cmb) Translate

func (cmb *Cmb) Translate(filename string) (*ir.IR, error)

Translate the cmb bill records to IR.

type Config

type Config struct {
	Rules []Rule `mapstructure:"rules,omitempty"`
}

Config is the configuration for Cmb.

type CreditOrder

type CreditOrder struct {
	SoldDate           *time.Time // 交易日
	PostedDate         time.Time  // 记账日
	Description        string     // 交易摘要
	RmbAmount          float64    // 人民币金额
	CardNo             string     // 卡号末四位
	OriginalTranAmount float64    // 交易地金额
	Type               OrderType  // 收/支 (数据中无该列,推测而来)
}

type DebitOrder

type DebitOrder struct {
	Date              time.Time // 记账日期
	Currency          string    // 货币
	TransactionAmount float64   // 交易金额
	Balance           float64   // 联机余额
	TransactionType   string    // 交易摘要
	CounterParty      string    // 对手信息(ir.peer)
	CustomerType      string    // 客户摘要(ir.item)
	Type              OrderType // 收/支 (数据中无该列,推测而来)
}

type OrderType

type OrderType string
const (
	OrderTypeSend    OrderType = "支出"
	OrderTypeRecv    OrderType = "收入"
	OrderTypeUnknown OrderType = "Unknown"
)

type Rule

type Rule struct {
	Peer          *string `mapstructure:"peer,omitempty"` // 交易对手
	Item          *string `mapstructure:"item,omitempty"` // 商品描述
	Type          *string `mapstructure:"type,omitempty"` // 类型
	TxType        *string `mapstructure:"txType,omitempty"`
	Separator     *string `mapstructure:"sep,omitempty"` // default: ,
	MethodAccount *string `mapstructure:"methodAccount,omitempty"`
	TargetAccount *string `mapstructure:"targetAccount,omitempty"`
	FullMatch     bool    `mapstructure:"fullMatch,omitempty"` // default: false
	Tag           *string `mapstructure:"tag,omitempty"`
	Ignore        bool    `mapstructure:"ignore,omitempty"` // default: false
}

Rule is the type for match rules.

type Statistics

type Statistics struct {
	UserID          string    `json:"user_id,omitempty"`
	Username        string    `json:"username,omitempty"`
	ParsedItems     int       `json:"parsed_items,omitempty"`
	Start           time.Time `json:"start,omitempty"`
	End             time.Time `json:"end,omitempty"`
	TotalInRecords  int       `json:"total_in_records,omitempty"`
	TotalInMoney    float64   `json:"total_in_money,omitempty"`
	TotalOutRecords int       `json:"total_out_records,omitempty"`
	TotalOutMoney   float64   `json:"total_out_money,omitempty"`
}

Jump to

Keyboard shortcuts

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