mirror of
https://github.com/aclindsa/moneygo.git
synced 2024-10-30 15:50:04 -04:00
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
package store
|
|
|
|
import (
|
|
"github.com/aclindsa/moneygo/internal/models"
|
|
)
|
|
|
|
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
|
|
GetUser(userid int64) (*models.User, error)
|
|
GetUserByUsername(username string) (*models.User, error)
|
|
UpdateUser(user *models.User) error
|
|
DeleteUser(user *models.User) error
|
|
}
|
|
|
|
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)
|
|
UpdateSecurity(security *models.Security) error
|
|
DeleteSecurity(security *models.Security) error
|
|
}
|
|
|
|
type Tx interface {
|
|
Commit() error
|
|
Rollback() error
|
|
|
|
SessionStore
|
|
UserStore
|
|
SecurityStore
|
|
}
|
|
|
|
type Store interface {
|
|
Begin() (Tx, error)
|
|
Close() error
|
|
}
|