Documentation ¶
Index ¶
- type DBORM
- type EventRepo
- type EventStore
- func (store *EventStore) AddEvent(event models.Event) (models.Event, error)
- func (store *EventStore) DeleteEvent(event *models.Event) error
- func (store *EventStore) GetAllEvents() (events []models.Event, err error)
- func (store *EventStore) GetEventByID(id int) (event models.Event, err error)
- func (store *EventStore) UpdateEvent(event models.Event) error
- type UserRepo
- type UserStore
- func (store *UserStore) AddUser(newUser models.User) (models.User, error)
- func (store *UserStore) DeleteUser(user models.User) error
- func (store *UserStore) GetAllUsers() (users []models.User, err error)
- func (store *UserStore) GetUserByAlias(alias string) (user models.User, err error)
- func (store *UserStore) GetUserByID(id int) (user models.User, err error)
- func (store *UserStore) UpdateUser(user *models.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventRepo ¶
type EventRepo interface { GetAllEvents() ([]models.Event, error) GetEventByID(id int) (models.Event, error) AddEvent(models.Event) (models.Event, error) UpdateEvent(models.Event) error DeleteEvent(*models.Event) error }
EventRepo is the abstraction for event related database operations
func NewEventRepo ¶
NewEventRepo is a constructor for DBORM
type EventStore ¶
type EventStore struct {
DBORM
}
EventStore is an ORM layer that satisfies the DBLayer interface
func (*EventStore) DeleteEvent ¶
func (store *EventStore) DeleteEvent(event *models.Event) error
DeleteEvent deletes an event object and returns it
func (*EventStore) GetAllEvents ¶
func (store *EventStore) GetAllEvents() (events []models.Event, err error)
GetAllEvents returns all events
func (*EventStore) GetEventByID ¶
func (store *EventStore) GetEventByID(id int) (event models.Event, err error)
GetEventByID returns an event or an error
func (*EventStore) UpdateEvent ¶
func (store *EventStore) UpdateEvent(event models.Event) error
UpdateEvent updates an Event object
type UserRepo ¶
type UserRepo interface { GetAllUsers() ([]models.User, error) GetUserByAlias(alias string) (models.User, error) GetUserByID(id int) (models.User, error) AddUser(models.User) (models.User, error) UpdateUser(*models.User) error DeleteUser(models.User) error }
UserRepo is the abstraction for user related database operations
type UserStore ¶
type UserStore struct {
DBORM
}
UserStore is an ORM layer that satisfies the UserRepo interface
func (*UserStore) DeleteUser ¶
DeleteUser deletes a User object and returns the object with DeletedAt timestamp
func (*UserStore) GetAllUsers ¶
GetAllUsers returns a list of User objects
func (*UserStore) GetUserByAlias ¶
GetUserByAlias returns the User object of the user with the given alias
func (*UserStore) GetUserByID ¶
GetUserByID returns the User object of the user with the given ID