Documentation
¶
Index ¶
- type AlertRepository
- func (repo AlertRepository) CreateAlert(alert easyalert.Alert) (easyalert.Alert, error)
- func (repo AlertRepository) DeleteAlert(alert easyalert.Alert) error
- func (repo AlertRepository) FindAlert(query string, params ...interface{}) (easyalert.Alert, error)
- func (repo AlertRepository) FindAlerts(query string, params ...interface{}) ([]easyalert.Alert, error)
- func (repo AlertRepository) UpdateAlert(alert easyalert.Alert) (easyalert.Alert, error)
- type UserRepository
- func (repo UserRepository) CreateUser(user easyalert.User) (easyalert.User, error)
- func (repo UserRepository) DeleteUser(user easyalert.User) error
- func (repo UserRepository) FindUser(query string, params ...interface{}) (easyalert.User, error)
- func (repo UserRepository) FindUsers() ([]easyalert.User, error)
- func (repo UserRepository) UpdateUser(user easyalert.User) (easyalert.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertRepository ¶
AlertRepository is a postgres implementation of the AlertRepository interface
func (AlertRepository) CreateAlert ¶
CreateAlert creates a new alert in the Postgres database and returns it with ID and created_at/updated_at filled.
func (AlertRepository) DeleteAlert ¶
func (repo AlertRepository) DeleteAlert(alert easyalert.Alert) error
DeleteAlert deletes the alert given as a parameter by using the ID.
func (AlertRepository) FindAlert ¶
func (repo AlertRepository) FindAlert(query string, params ...interface{}) (easyalert.Alert, error)
FindAlert fetches an alert using the query passed as a string and returns it. If the alert does not exist it will return easyalert.ErrRecordDoesNotExist.
func (AlertRepository) FindAlerts ¶
func (repo AlertRepository) FindAlerts(query string, params ...interface{}) ([]easyalert.Alert, error)
FindAlerts fetches all alerts based on the query and returns them.
func (AlertRepository) UpdateAlert ¶
UpdateAlert updates an existing alert in the Postgres database and returns it with updated_at updated.
type UserRepository ¶
UserRepository is a postgres implementation of the UserRepository interface
func (UserRepository) CreateUser ¶
CreateUser creates a user in the Postgres database and returns it with ID and created_at/updated_at filled.
func (UserRepository) DeleteUser ¶
func (repo UserRepository) DeleteUser(user easyalert.User) error
DeleteUser deletes a user and returns an error if one occurs.
func (UserRepository) FindUser ¶
func (repo UserRepository) FindUser(query string, params ...interface{}) (easyalert.User, error)
FindUser fetches a user by ID and returns it. If the user does not exist it will return easyalert.ErrRecordDoesNotExist.
func (UserRepository) FindUsers ¶
func (repo UserRepository) FindUsers() ([]easyalert.User, error)
FindUsers fetches all users and returns them.
func (UserRepository) UpdateUser ¶
UpdateUser updates all fields of the user in the Postgres database and returns it with updated_at refreshed.