mirror of
https://github.com/aclindsa/moneygo.git
synced 2025-07-02 20:28:38 -04:00
Move prices to store
This commit is contained in:
@ -2,15 +2,9 @@ package store
|
||||
|
||||
import (
|
||||
"github.com/aclindsa/moneygo/internal/models"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SessionStore interface {
|
||||
SessionExists(secret string) (bool, error)
|
||||
InsertSession(session *models.Session) error
|
||||
GetSession(secret string) (*models.Session, error)
|
||||
DeleteSession(session *models.Session) error
|
||||
}
|
||||
|
||||
type UserStore interface {
|
||||
UsernameExists(username string) (bool, error)
|
||||
InsertUser(user *models.User) error
|
||||
@ -20,6 +14,13 @@ type UserStore interface {
|
||||
DeleteUser(user *models.User) error
|
||||
}
|
||||
|
||||
type SessionStore interface {
|
||||
SessionExists(secret string) (bool, error)
|
||||
InsertSession(session *models.Session) error
|
||||
GetSession(secret string) (*models.Session, error)
|
||||
DeleteSession(session *models.Session) error
|
||||
}
|
||||
|
||||
type SecurityInUseError struct {
|
||||
Message string
|
||||
}
|
||||
@ -37,6 +38,17 @@ type SecurityStore interface {
|
||||
DeleteSecurity(security *models.Security) error
|
||||
}
|
||||
|
||||
type PriceStore interface {
|
||||
PriceExists(price *models.Price) (bool, error)
|
||||
InsertPrice(price *models.Price) error
|
||||
GetPrice(priceid, securityid int64) (*models.Price, error)
|
||||
GetPrices(securityid int64) (*[]*models.Price, error)
|
||||
GetLatestPrice(security, currency *models.Security, date *time.Time) (*models.Price, error)
|
||||
GetEarliestPrice(security, currency *models.Security, date *time.Time) (*models.Price, error)
|
||||
UpdatePrice(price *models.Price) error
|
||||
DeletePrice(price *models.Price) error
|
||||
}
|
||||
|
||||
type ParentAccountMissingError struct{}
|
||||
|
||||
func (pame ParentAccountMissingError) Error() string {
|
||||
@ -64,14 +76,23 @@ type AccountStore interface {
|
||||
DeleteAccount(account *models.Account) error
|
||||
}
|
||||
|
||||
type TransactionStore interface {
|
||||
}
|
||||
|
||||
type ReportStore interface {
|
||||
}
|
||||
|
||||
type Tx interface {
|
||||
Commit() error
|
||||
Rollback() error
|
||||
|
||||
SessionStore
|
||||
UserStore
|
||||
SessionStore
|
||||
SecurityStore
|
||||
PriceStore
|
||||
AccountStore
|
||||
TransactionStore
|
||||
ReportStore
|
||||
}
|
||||
|
||||
type Store interface {
|
||||
|
Reference in New Issue
Block a user