Documentation
¶
Index ¶
- Constants
- type AuthTokenSQLStore
- type AuthTokenStore
- type ExpenseFilter
- type ExpenseSQLStore
- func (ess ExpenseSQLStore) DeleteAccount(expenseAccount *model.ExpenseAccount) error
- func (ess ExpenseSQLStore) GetAccountByID(id string) (*model.ExpenseAccount, error)
- func (ess ExpenseSQLStore) GetByID(id string) (*model.Expense, error)
- func (ess ExpenseSQLStore) GetExpenseAccounts(userId string) ([]model.ExpenseAccount, error)
- func (ess ExpenseSQLStore) GetExpenses(userId string, filter ExpenseFilter) ([]model.Expense, error)
- func (ess ExpenseSQLStore) Store(expense *model.Expense) error
- func (ess ExpenseSQLStore) StoreAccount(expenseAccount model.ExpenseAccount) error
- type ExpenseStore
- type SQLStore
- type Store
- type UserSQLStore
- type UserStore
Constants ¶
const UniqueEmailConstraint = "users_unique_email"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthTokenSQLStore ¶
type AuthTokenSQLStore struct {
// contains filtered or unexported fields
}
AuthTokenSQLStore is the SQL implementation of AuthTokenStore interface
func NewAuthTokenSQLStore ¶
func NewAuthTokenSQLStore(sqlStore SQLStore) *AuthTokenSQLStore
NewAuthTokenSQLStore returns new AuthTokenSQLStore object.
type AuthTokenStore ¶
type AuthTokenStore interface { Create(user *model.User) (*model.AuthToken, error) Find(token string) (*model.AuthToken, error) }
AuthTokenStore is an interface for AuthToken implementations.
type ExpenseFilter ¶
func (*ExpenseFilter) ParseURLValues ¶
func (f *ExpenseFilter) ParseURLValues(values url.Values)
type ExpenseSQLStore ¶
type ExpenseSQLStore struct {
// contains filtered or unexported fields
}
ExpenseSQLStore is the SQL implementation of ExpenseStore interface.
func NewExpenseSQLStore ¶
func NewExpenseSQLStore(sqlStore SQLStore) *ExpenseSQLStore
NewExpenseSQLStore returns new ExpenseSQLStore object.
func (ExpenseSQLStore) DeleteAccount ¶
func (ess ExpenseSQLStore) DeleteAccount(expenseAccount *model.ExpenseAccount) error
func (ExpenseSQLStore) GetAccountByID ¶
func (ess ExpenseSQLStore) GetAccountByID(id string) (*model.ExpenseAccount, error)
func (ExpenseSQLStore) GetByID ¶
func (ess ExpenseSQLStore) GetByID(id string) (*model.Expense, error)
GetByID fetches the Expense object with given id with its related ExpenseAccount, ExpenseCategory and User
func (ExpenseSQLStore) GetExpenseAccounts ¶
func (ess ExpenseSQLStore) GetExpenseAccounts(userId string) ([]model.ExpenseAccount, error)
func (ExpenseSQLStore) GetExpenses ¶
func (ess ExpenseSQLStore) GetExpenses(userId string, filter ExpenseFilter) ([]model.Expense, error)
func (ExpenseSQLStore) Store ¶
func (ess ExpenseSQLStore) Store(expense *model.Expense) error
Store saves the given expense object into database after populating ID, CreatedAt and UpdatedAt fields.
func (ExpenseSQLStore) StoreAccount ¶
func (ess ExpenseSQLStore) StoreAccount(expenseAccount model.ExpenseAccount) error
type ExpenseStore ¶
type ExpenseStore interface { Store(expense *model.Expense) error GetByID(id string) (*model.Expense, error) GetExpenses(userId string, filter ExpenseFilter) ([]model.Expense, error) StoreAccount(expense model.ExpenseAccount) error GetExpenseAccounts(userId string) ([]model.ExpenseAccount, error) GetAccountByID(id string) (*model.ExpenseAccount, error) DeleteAccount(*model.ExpenseAccount) error }
ExpenseStore is the interface that defines methods expected in ExpenseStore implemntations
type SQLStore ¶
type SQLStore struct {
// contains filtered or unexported fields
}
SQLStore : SQL implementation of store.
func NewSQLStore ¶
NewSQLStore : Initializes SQLStore object, establishes db connection with the given parameters and return it.
func (SQLStore) AuthToken ¶
func (sqlStore SQLStore) AuthToken() AuthTokenStore
AuthToken returns AuthTokenSQLStore which is required to implement Store interface.
func (SQLStore) Expense ¶
func (sqlStore SQLStore) Expense() ExpenseStore
Expense returns ExpenseSQLStore to implement Store interface
type Store ¶
type Store interface { User() UserStore AuthToken() AuthTokenStore Expense() ExpenseStore }
Store : Interface for the different store options
type UserSQLStore ¶
type UserSQLStore struct {
// contains filtered or unexported fields
}
UserSQLStore : SQL implementation for UserStore interface.
func NewUserSQLStore ¶
func NewUserSQLStore(sqlStore SQLStore) *UserSQLStore
NewUserSQLStore : Create new UserSQLStore with a SQLStore object.
func (UserSQLStore) GetUserByEmail ¶
func (uss UserSQLStore) GetUserByEmail(email string) (*model.User, error)
GetUserByEmail : Fetch the user with give email as model.User
func (UserSQLStore) GetUserByID ¶
func (uss UserSQLStore) GetUserByID(id string) (*model.User, error)
GetUserByID : Fetch the user with given id as model.User
func (UserSQLStore) StoreUser ¶
func (uss UserSQLStore) StoreUser(user model.User) error
StoreUser : Store the given model.User object to database.
func (UserSQLStore) UpdateUser ¶
func (uss UserSQLStore) UpdateUser(user model.User) error
UpdateUser : Update the given model.User object in db.