Documentation
¶
Index ¶
- Constants
- Variables
- type Account
- type AccountList
- type AccountTransactionsList
- type AccountType
- type Amount
- func (amount Amount) Fractional(precision uint64) (int64, error)
- func (amount *Amount) FromParts(whole, fractional int64, precision uint64)
- func (amount Amount) MarshalJSON() ([]byte, error)
- func (amount Amount) Precision() uint64
- func (amount *Amount) Round(precision uint64)
- func (amount Amount) String() string
- func (amount *Amount) UnmarshalJSON(bytes []byte) error
- func (amount Amount) Whole() (int64, error)
- type PrecisionError
- type Price
- type PriceList
- type Report
- type ReportList
- type Security
- type SecurityList
- type SecurityType
- type Series
- type Session
- type Split
- type Tabulation
- type Transaction
- type TransactionList
- type User
Constants ¶
View Source
const ( Bank AccountType = 1 // start at 1 so that the default (0) is invalid Cash = 2 Asset = 3 Liability = 4 Investment = 5 Income = 6 Expense = 7 Trading = 8 Equity = 9 Receivable = 10 Payable = 11 )
View Source
const ( Imported int64 = 1 Entered = 2 Cleared = 3 Reconciled = 4 Voided = 5 )
Split.Status
View Source
const ( Default int64 = 0 ImportAccount = 1 // This split belongs to the main account being imported SubAccount = 2 // This split belongs to a sub-account of that being imported ExternalAccount = 3 TradingAccount = 4 Commission = 5 Taxes = 6 Fees = 7 Load = 8 IncomeAccount = 9 ExpenseAccount = 10 )
Split.ImportSplitType
View Source
const BogusPassword = "password"
View Source
const LuaMaxLength int = 65536
The maximum length (in bytes) the Lua code may be. This is used to set the max size of the database columns (with an added fudge factor)
View Source
const MaxPrecision uint64 = 15
MaxPrexision denotes the maximum valid value for Security.Precision
Variables ¶
View Source
var AccountTypes = []AccountType{ Bank, Cash, Asset, Liability, Investment, Income, Expense, Trading, Equity, Receivable, Payable, }
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
AccountId int64
ExternalAccountId string
UserId int64
SecurityId int64
ParentAccountId int64 // -1 if this account is at the root
Type AccountType
Name string
// monotonically-increasing account transaction version number. Used for
// allowing a client to ensure they have a consistent version when paging
// through transactions.
AccountVersion int64 `json:"Version"`
// Optional fields specifying how to fetch transactions from a bank via OFX
OFXURL string
OFXORG string
OFXFID string
OFXUser string
OFXBankID string // OFX BankID (BrokerID if AcctType == Investment)
OFXAcctID string
OFXAcctType string // ofxgo.acctType
OFXClientUID string
OFXAppID string
OFXAppVer string
OFXVersion string
OFXNoIndent bool
}
type AccountList ¶
type AccountList struct {
Accounts *[]*Account `json:"accounts"`
}
func (*AccountList) Read ¶
func (al *AccountList) Read(json_str string) error
func (*AccountList) Write ¶
func (al *AccountList) Write(w http.ResponseWriter) error
type AccountTransactionsList ¶
type AccountTransactionsList struct {
Account *Account
Transactions *[]*Transaction
TotalTransactions int64
BeginningBalance Amount
EndingBalance Amount
}
func (*AccountTransactionsList) Read ¶
func (atl *AccountTransactionsList) Read(json_str string) error
func (*AccountTransactionsList) Write ¶
func (atl *AccountTransactionsList) Write(w http.ResponseWriter) error
type AccountType ¶
type AccountType int64
func (AccountType) String ¶
func (t AccountType) String() string
type Amount ¶
func (Amount) Fractional ¶
Fractional returns the fractional portion of the Amount, multiplied by 10^precision
func (*Amount) FromParts ¶
FromParts re-assembles an Amount from the results from previous calls to Whole and Fractional
func (Amount) MarshalJSON ¶
func (Amount) Precision ¶
Precision returns the minimum positive integer p such that if you multiplied this Amount by 10^p, it would become an integer
func (*Amount) UnmarshalJSON ¶
type PrecisionError ¶
type PrecisionError struct {
// contains filtered or unexported fields
}
func (PrecisionError) Error ¶
func (p PrecisionError) Error() string
type Price ¶
type ReportList ¶
type ReportList struct {
Reports *[]*Report `json:"reports"`
}
func (*ReportList) Read ¶
func (rl *ReportList) Read(json_str string) error
func (*ReportList) Write ¶
func (rl *ReportList) Write(w http.ResponseWriter) error
type Security ¶
type Security struct {
SecurityId int64
UserId int64
Name string
Description string
Symbol string
// Number of decimal digits (to the right of the decimal point) this
// security is precise to
Precision uint64 `db:"Preciseness"`
Type SecurityType
// AlternateId is CUSIP for Type=Stock, ISO4217 for Type=Currency
AlternateId string
}
type SecurityList ¶
type SecurityList struct {
Securities *[]*Security `json:"securities"`
}
func (*SecurityList) Read ¶
func (sl *SecurityList) Read(json_str string) error
func (*SecurityList) Write ¶
func (sl *SecurityList) Write(w http.ResponseWriter) error
type SecurityType ¶
type SecurityType int64
const ( Currency SecurityType = 1 Stock = 2 )
func GetSecurityType ¶
func GetSecurityType(typestring string) SecurityType
type Session ¶
type Session struct {
SessionId int64
SessionSecret string `json:"-"`
UserId int64
Created time.Time
Expires time.Time
}
func NewSession ¶
type Split ¶
type Split struct {
SplitId int64
TransactionId int64
Status int64
ImportSplitType int64
// One of AccountId and SecurityId must be -1
// In normal splits, AccountId will be valid and SecurityId will be -1. The
// only case where this is reversed is for transactions that have been
// imported and not yet associated with an account.
AccountId int64
SecurityId int64
RemoteId string // unique ID from server, for detecting duplicates
Number string // Check or reference number
Memo string
Amount Amount
}
type Tabulation ¶
type Tabulation struct {
ReportId int64
Title string
Subtitle string
Units string
Labels []string
Series map[string]*Series
}
func (*Tabulation) Read ¶
func (t *Tabulation) Read(json_str string) error
func (*Tabulation) Write ¶
func (t *Tabulation) Write(w http.ResponseWriter) error
type Transaction ¶
type Transaction struct {
TransactionId int64
UserId int64
Description string
Date time.Time
Splits []*Split `db:"-"`
}
func (*Transaction) Read ¶
func (t *Transaction) Read(json_str string) error
func (*Transaction) Valid ¶
func (t *Transaction) Valid() bool
func (*Transaction) Write ¶
func (t *Transaction) Write(w http.ResponseWriter) error
type TransactionList ¶
type TransactionList struct {
Transactions *[]*Transaction `json:"transactions"`
}
func (*TransactionList) Read ¶
func (tl *TransactionList) Read(json_str string) error
func (*TransactionList) Write ¶
func (tl *TransactionList) Write(w http.ResponseWriter) error
type User ¶
type User struct {
UserId int64
DefaultCurrency int64 // SecurityId of default currency, or ISO4217 code for it if creating new user
Name string
Username string
Password string `db:"-"`
PasswordHash string `json:"-"`
Email string
}
func (*User) HashPassword ¶
func (u *User) HashPassword()
Click to show internal directories.
Click to hide internal directories.