Documentation ¶
Index ¶
- func CreatePriceIfNotExist(tx store.Tx, price *models.Price) error
- func DeleteSessionIfExists(tx store.Tx, r *http.Request) error
- func FindCurrencyTemplate(iso4217 int64) *models.Security
- func FindSecurityTemplate(name string, _type models.SecurityType) *models.Security
- func GetCreateAccount(tx store.Tx, a models.Account) (*models.Account, error)
- func GetImbalanceAccount(tx store.Tx, userid int64, securityid int64) (*models.Account, error)
- func GetSession(tx store.Tx, r *http.Request) (*models.Session, error)
- func GetTradingAccount(tx store.Tx, userid int64, securityid int64) (*models.Account, error)
- func GetTransactionImbalances(tx store.Tx, t *models.Transaction) (map[int64]big.Rat, error)
- func GetUserFromSession(tx store.Tx, r *http.Request) (*models.User, error)
- func ImportGetCreateSecurity(tx store.Tx, userid int64, security *models.Security) (*models.Security, error)
- func InsertUser(tx store.Tx, u *models.User) error
- func ReadJSON(r *http.Request, v interface{}) error
- func SearchSecurityTemplates(search string, _type models.SecurityType, limit int64) []*models.Security
- func TransactionBalanced(tx store.Tx, t *models.Transaction) (bool, error)
- func UpdateSecurity(tx store.Tx, s *models.Security) (err error)
- func UpdateUser(tx store.Tx, u *models.User) error
- type APIHandler
- type Context
- type Error
- type GnucashAccount
- type GnucashCommodity
- type GnucashDate
- type GnucashImport
- type GnucashPrice
- type GnucashPriceDB
- type GnucashSplit
- type GnucashTime
- type GnucashTransaction
- type GnucashXMLCommodity
- type GnucashXMLImport
- type Handler
- type NewSessionWriter
- type OFXDownload
- type OFXImport
- func (i *OFXImport) AddInvTransaction(invtran *ofxgo.InvTransaction, account *models.Account, ...) error
- func (i *OFXImport) AddTransaction(tran *ofxgo.Transaction, account *models.Account) error
- func (i *OFXImport) GetAddCurrency(isoname string) (*models.Security, error)
- func (i *OFXImport) GetIncomeTran(income *ofxgo.Income, curdef *models.Security, account *models.Account) (*models.Transaction, error)
- func (i *OFXImport) GetInvBuyTran(buy *ofxgo.InvBuy, curdef *models.Security, account *models.Account) (*models.Transaction, error)
- func (i *OFXImport) GetInvExpenseTran(expense *ofxgo.InvExpense, curdef *models.Security, account *models.Account) (*models.Transaction, error)
- func (i *OFXImport) GetInvSellTran(sell *ofxgo.InvSell, curdef *models.Security, account *models.Account) (*models.Transaction, error)
- func (i *OFXImport) GetInvTran(invtran *ofxgo.InvTran) models.Transaction
- func (i *OFXImport) GetMarginInterestTran(marginint *ofxgo.MarginInterest, curdef *models.Security, ...) (*models.Transaction, error)
- func (i *OFXImport) GetReinvestTran(reinvest *ofxgo.Reinvest, curdef *models.Security, account *models.Account) (*models.Transaction, error)
- func (i *OFXImport) GetRetOfCapTran(retofcap *ofxgo.RetOfCap, curdef *models.Security, account *models.Account) (*models.Transaction, error)
- func (i *OFXImport) GetSecurity(ofxsecurityid int64) (*models.Security, error)
- func (i *OFXImport) GetSecurityAlternateId(alternateid string, securityType models.SecurityType) (*models.Security, error)
- func (i *OFXImport) GetTransferTran(transfer *ofxgo.Transfer, account *models.Account) (*models.Transaction, error)
- type ResponseWrapper
- type ResponseWriterWriter
- func AccountHandler(r *http.Request, context *Context) ResponseWriterWriter
- func AccountImportHandler(context *Context, r *http.Request, user *models.User, accountid int64) ResponseWriterWriter
- func AccountTransactionsHandler(context *Context, r *http.Request, user *models.User, accountid int64) ResponseWriterWriter
- func GnucashImportHandler(r *http.Request, context *Context) ResponseWriterWriter
- func ImportHandler(r *http.Request, context *Context) ResponseWriterWriter
- func OFXFileImportHandler(context *Context, r *http.Request, user *models.User, accountid int64) ResponseWriterWriter
- func OFXImportHandler(context *Context, r *http.Request, user *models.User, accountid int64) ResponseWriterWriter
- func PriceHandler(r *http.Request, context *Context, user *models.User, securityid int64) ResponseWriterWriter
- func ReportHandler(r *http.Request, context *Context) ResponseWriterWriter
- func ReportTabulationHandler(tx store.Tx, r *http.Request, user *models.User, reportid int64) ResponseWriterWriter
- func SecurityHandler(r *http.Request, context *Context) ResponseWriterWriter
- func SecurityTemplateHandler(r *http.Request, context *Context) ResponseWriterWriter
- func SessionHandler(r *http.Request, context *Context) ResponseWriterWriter
- func TransactionHandler(r *http.Request, context *Context) ResponseWriterWriter
- func UserHandler(r *http.Request, context *Context) ResponseWriterWriter
- type SuccessWriter
- type UserExistsError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindCurrencyTemplate ¶
func FindSecurityTemplate ¶
func FindSecurityTemplate(name string, _type models.SecurityType) *models.Security
func GetCreateAccount ¶
Get (and attempt to create if it doesn't exist). Matches on UserId, SecurityId, Type, Name, and ParentAccountId
func GetImbalanceAccount ¶
Get (and attempt to create if it doesn't exist) the security/currency imbalance account for the supplied security/currency
func GetTradingAccount ¶
Get (and attempt to create if it doesn't exist) the security/currency trading account for the supplied security/currency
func GetTransactionImbalances ¶
Return a map of security ID's to big.Rat's containing the amount that security is imbalanced by
func GetUserFromSession ¶
func ImportGetCreateSecurity ¶
func SearchSecurityTemplates ¶
func TransactionBalanced ¶
Returns true if all securities contained in this transaction are balanced, false otherwise
Types ¶
type APIHandler ¶
func (*APIHandler) ServeHTTP ¶
func (ah *APIHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type GnucashAccount ¶
type GnucashAccount struct { Version string `xml:"version,attr"` AccountId string `xml:"http://www.gnucash.org/XML/act id"` ParentAccountId string `xml:"http://www.gnucash.org/XML/act parent"` Name string `xml:"http://www.gnucash.org/XML/act name"` Description string `xml:"http://www.gnucash.org/XML/act description"` Type string `xml:"http://www.gnucash.org/XML/act type"` Commodity GnucashXMLCommodity `xml:"http://www.gnucash.org/XML/act commodity"` // contains filtered or unexported fields }
type GnucashCommodity ¶
func (*GnucashCommodity) UnmarshalXML ¶
func (gc *GnucashCommodity) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type GnucashDate ¶
type GnucashDate struct {
Date GnucashTime `xml:"http://www.gnucash.org/XML/ts date"`
}
type GnucashImport ¶
type GnucashImport struct { Securities []models.Security Accounts []models.Account Transactions []models.Transaction Prices []models.Price }
func ImportGnucash ¶
func ImportGnucash(r io.Reader) (*GnucashImport, error)
type GnucashPrice ¶
type GnucashPrice struct { Id string `xml:"http://www.gnucash.org/XML/price id"` Commodity GnucashCommodity `xml:"http://www.gnucash.org/XML/price commodity"` Currency GnucashCommodity `xml:"http://www.gnucash.org/XML/price currency"` Date GnucashDate `xml:"http://www.gnucash.org/XML/price time"` Source string `xml:"http://www.gnucash.org/XML/price source"` Type string `xml:"http://www.gnucash.org/XML/price type"` Value string `xml:"http://www.gnucash.org/XML/price value"` }
type GnucashPriceDB ¶
type GnucashPriceDB struct {
Prices []GnucashPrice `xml:"price"`
}
type GnucashSplit ¶
type GnucashSplit struct { SplitId string `xml:"http://www.gnucash.org/XML/split id"` Status string `xml:"http://www.gnucash.org/XML/split reconciled-state"` AccountId string `xml:"http://www.gnucash.org/XML/split account"` Memo string `xml:"http://www.gnucash.org/XML/split memo"` Amount string `xml:"http://www.gnucash.org/XML/split quantity"` Value string `xml:"http://www.gnucash.org/XML/split value"` }
type GnucashTime ¶
func (*GnucashTime) UnmarshalXML ¶
func (g *GnucashTime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type GnucashTransaction ¶
type GnucashTransaction struct { TransactionId string `xml:"http://www.gnucash.org/XML/trn id"` Description string `xml:"http://www.gnucash.org/XML/trn description"` Number string `xml:"http://www.gnucash.org/XML/trn num"` DatePosted GnucashDate `xml:"http://www.gnucash.org/XML/trn date-posted"` DateEntered GnucashDate `xml:"http://www.gnucash.org/XML/trn date-entered"` Commodity GnucashXMLCommodity `xml:"http://www.gnucash.org/XML/trn currency"` Splits []GnucashSplit `xml:"http://www.gnucash.org/XML/trn splits>split"` }
type GnucashXMLCommodity ¶
type GnucashXMLCommodity struct { Name string `xml:"http://www.gnucash.org/XML/cmdty id"` Description string `xml:"http://www.gnucash.org/XML/cmdty name"` Type string `xml:"http://www.gnucash.org/XML/cmdty space"` Fraction int `xml:"http://www.gnucash.org/XML/cmdty fraction"` XCode string `xml:"http://www.gnucash.org/XML/cmdty xcode"` }
type GnucashXMLImport ¶
type GnucashXMLImport struct { XMLName xml.Name `xml:"gnc-v2"` Commodities []GnucashCommodity `xml:"http://www.gnucash.org/XML/gnc book>commodity"` PriceDB GnucashPriceDB `xml:"http://www.gnucash.org/XML/gnc book>pricedb"` Accounts []GnucashAccount `xml:"http://www.gnucash.org/XML/gnc book>account"` Transactions []GnucashTransaction `xml:"http://www.gnucash.org/XML/gnc book>transaction"` }
type NewSessionWriter ¶
type NewSessionWriter struct {
// contains filtered or unexported fields
}
func NewSession ¶
func (*NewSessionWriter) Write ¶
func (n *NewSessionWriter) Write(w http.ResponseWriter) error
type OFXDownload ¶
func (*OFXDownload) Read ¶
func (od *OFXDownload) Read(json_str string) error
type OFXImport ¶
type OFXImport struct { Securities []models.Security Accounts []models.Account Transactions []models.Transaction }
func (*OFXImport) AddInvTransaction ¶
func (*OFXImport) AddTransaction ¶
func (*OFXImport) GetAddCurrency ¶
func (*OFXImport) GetIncomeTran ¶
func (*OFXImport) GetInvBuyTran ¶
func (*OFXImport) GetInvExpenseTran ¶
func (i *OFXImport) GetInvExpenseTran(expense *ofxgo.InvExpense, curdef *models.Security, account *models.Account) (*models.Transaction, error)
func (*OFXImport) GetInvSellTran ¶
func (*OFXImport) GetInvTran ¶
func (i *OFXImport) GetInvTran(invtran *ofxgo.InvTran) models.Transaction
func (*OFXImport) GetMarginInterestTran ¶
func (i *OFXImport) GetMarginInterestTran(marginint *ofxgo.MarginInterest, curdef *models.Security, account *models.Account) (*models.Transaction, error)
func (*OFXImport) GetReinvestTran ¶
func (*OFXImport) GetRetOfCapTran ¶
func (*OFXImport) GetSecurity ¶
func (*OFXImport) GetSecurityAlternateId ¶
func (*OFXImport) GetTransferTran ¶
type ResponseWrapper ¶
type ResponseWrapper struct { Code int Writer ResponseWriterWriter }
func (ResponseWrapper) Write ¶
func (r ResponseWrapper) Write(w http.ResponseWriter) error
type ResponseWriterWriter ¶
type ResponseWriterWriter interface {
Write(http.ResponseWriter) error
}
But who writes the ResponseWriterWriter?
func AccountHandler ¶
func AccountHandler(r *http.Request, context *Context) ResponseWriterWriter
func AccountImportHandler ¶
func AccountImportHandler(context *Context, r *http.Request, user *models.User, accountid int64) ResponseWriterWriter
* Assumes the User is a valid, signed-in user, but accountid has not yet been validated
func AccountTransactionsHandler ¶
func AccountTransactionsHandler(context *Context, r *http.Request, user *models.User, accountid int64) ResponseWriterWriter
Return only those transactions which have at least one split pertaining to an account
func GnucashImportHandler ¶
func GnucashImportHandler(r *http.Request, context *Context) ResponseWriterWriter
func ImportHandler ¶
func ImportHandler(r *http.Request, context *Context) ResponseWriterWriter
func OFXFileImportHandler ¶
func OFXImportHandler ¶
func PriceHandler ¶
func ReportHandler ¶
func ReportHandler(r *http.Request, context *Context) ResponseWriterWriter
func ReportTabulationHandler ¶
func SecurityHandler ¶
func SecurityHandler(r *http.Request, context *Context) ResponseWriterWriter
func SecurityTemplateHandler ¶
func SecurityTemplateHandler(r *http.Request, context *Context) ResponseWriterWriter
func SessionHandler ¶
func SessionHandler(r *http.Request, context *Context) ResponseWriterWriter
func TransactionHandler ¶
func TransactionHandler(r *http.Request, context *Context) ResponseWriterWriter
func UserHandler ¶
func UserHandler(r *http.Request, context *Context) ResponseWriterWriter
type SuccessWriter ¶
type SuccessWriter struct{}
func (SuccessWriter) Write ¶
func (s SuccessWriter) Write(w http.ResponseWriter) error
type UserExistsError ¶
type UserExistsError struct{}
func (UserExistsError) Error ¶
func (ueu UserExistsError) Error() string