Documentation ¶
Index ¶
- type PostgresStore
- func (s *PostgresStore) CreateAccount(acc *types.Account) error
- func (s *PostgresStore) DeleteAccount(id int) error
- func (s *PostgresStore) GetAccountByID(id int) (*types.Account, error)
- func (s *PostgresStore) GetAccountByNumber(number int) (*types.Account, error)
- func (s *PostgresStore) GetAccounts() ([]*types.Account, error)
- func (s *PostgresStore) GetMetric(id int) (*types.QueryMetrics, error)
- func (s *PostgresStore) GetMetricsAll() ([]*types.QueryMetrics, error)
- func (s *PostgresStore) GetMetricsByDate(dates types.DateTimeQuery) ([]*types.QueryMetrics, error)
- func (s *PostgresStore) Init() error
- type UserStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresStore ¶
type PostgresStore struct {
// contains filtered or unexported fields
}
PostgresStore is a type that contains the db for userstore
func NewPostgresStore ¶
func NewPostgresStore() (*PostgresStore, error)
NewPostgresStore creates the db connection and checks if it is live
func (*PostgresStore) CreateAccount ¶
func (s *PostgresStore) CreateAccount(acc *types.Account) error
Creates user account entry
func (*PostgresStore) DeleteAccount ¶
func (s *PostgresStore) DeleteAccount(id int) error
Hard deletes user account from account table
func (*PostgresStore) GetAccountByID ¶
func (s *PostgresStore) GetAccountByID(id int) (*types.Account, error)
Gets a single user account by the user's id
func (*PostgresStore) GetAccountByNumber ¶
func (s *PostgresStore) GetAccountByNumber(number int) (*types.Account, error)
Gets a single user account by the account number
func (*PostgresStore) GetAccounts ¶
func (s *PostgresStore) GetAccounts() ([]*types.Account, error)
Gets all accounts
func (*PostgresStore) GetMetric ¶
func (s *PostgresStore) GetMetric(id int) (*types.QueryMetrics, error)
Gets a single metric from the metrics table based on the metric id
func (*PostgresStore) GetMetricsAll ¶
func (s *PostgresStore) GetMetricsAll() ([]*types.QueryMetrics, error)
Gets all metrics from the metrics table
func (*PostgresStore) GetMetricsByDate ¶
func (s *PostgresStore) GetMetricsByDate(dates types.DateTimeQuery) ([]*types.QueryMetrics, error)
Gets metrics from the metrics table based on a time.Time range
func (*PostgresStore) Init ¶
func (s *PostgresStore) Init() error
Init initializes the user account table
type UserStorage ¶
type UserStorage interface { //accounts CreateAccount(*types.Account) error DeleteAccount(int) error GetAccounts() ([]*types.Account, error) GetAccountByID(int) (*types.Account, error) GetAccountByNumber(int) (*types.Account, error) //metrics queries GetMetric(int) (*types.QueryMetrics, error) GetMetricsAll() ([]*types.QueryMetrics, error) GetMetricsByDate(types.DateTimeQuery) ([]*types.QueryMetrics, error) }
UserStorage acts as in interface on all functions necessary for an API user
Click to show internal directories.
Click to hide internal directories.