1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-02 20:28:38 -04:00

Move accounts to store

This commit is contained in:
2017-12-07 20:47:55 -05:00
parent bec5152e53
commit 3326c3b292
11 changed files with 211 additions and 183 deletions

View File

@ -20,15 +20,50 @@ type UserStore interface {
DeleteUser(user *models.User) error
}
type SecurityInUseError struct {
Message string
}
func (e SecurityInUseError) Error() string {
return e.Message
}
type SecurityStore interface {
InsertSecurity(security *models.Security) error
GetSecurity(securityid int64, userid int64) (*models.Security, error)
GetSecurities(userid int64) (*[]*models.Security, error)
FindMatchingSecurities(userid int64, security *models.Security) (*[]*models.Security, error)
FindMatchingSecurities(security *models.Security) (*[]*models.Security, error)
UpdateSecurity(security *models.Security) error
DeleteSecurity(security *models.Security) error
}
type ParentAccountMissingError struct{}
func (pame ParentAccountMissingError) Error() string {
return "Parent account missing"
}
type TooMuchNestingError struct{}
func (tmne TooMuchNestingError) Error() string {
return "Too much account nesting"
}
type CircularAccountsError struct{}
func (cae CircularAccountsError) Error() string {
return "Would result in circular account relationship"
}
type AccountStore interface {
InsertAccount(account *models.Account) error
GetAccount(accountid int64, userid int64) (*models.Account, error)
GetAccounts(userid int64) (*[]*models.Account, error)
FindMatchingAccounts(account *models.Account) (*[]*models.Account, error)
UpdateAccount(account *models.Account) error
DeleteAccount(account *models.Account) error
}
type Tx interface {
Commit() error
Rollback() error
@ -36,6 +71,7 @@ type Tx interface {
SessionStore
UserStore
SecurityStore
AccountStore
}
type Store interface {