Documentation ¶
Index ¶
- type DBClient
- type Database
- func (db *Database) AddNewApplicant(clubID string, applicant *models.Applicant) error
- func (db *Database) AddNewApplication(clubID string, application *models.Application) error
- func (db *Database) AddNewClub(c *models.Club, cu *models.ClubUser) error
- func (db *Database) AddNewEvent(clubID string, event *models.EventProps) error
- func (db *Database) AddNewPeriod(clubID string, period *models.Period) error
- func (db *Database) AddNewUser(u *models.User, e *models.EmailVerification) error
- func (db *Database) AddTag(clubID string, tag *models.Tag) error
- func (db *Database) DeleteApplicant(clubID string, period string, email string) error
- func (db *Database) DeleteApplication(clubID string, period string, eventID string, email string) error
- func (db *Database) DeleteClub(id string) error
- func (db *Database) DeleteEvent(clubID string, period string, eventID string) error
- func (db *Database) DeleteTag(clubID string, period string, tag string) error
- func (db *Database) DeleteUser(email string) error
- func (db *Database) GetAllClubUsers(id string) ([]*models.ClubUser, error)
- func (db *Database) GetApplicant(clubID string, period string, email string) (*models.Applicant, error)
- func (db *Database) GetApplicants(clubID string, period string) ([]*models.Applicant, error)
- func (db *Database) GetApplication(clubID string, period string, eventID string, email string) (*models.Application, error)
- func (db *Database) GetApplications(clubID string, period string, eventID string) ([]*models.Application, error)
- func (db *Database) GetClub(id string) (*models.Club, error)
- func (db *Database) GetEmailVerification(email string, hash string) (*models.EmailVerification, error)
- func (db *Database) GetEvent(clubID string, period string, eventID string) (*models.EventProps, error)
- func (db *Database) GetEvents(clubID string, period string) ([]*models.EventProps, error)
- func (db *Database) GetTags(clubID string, period string) ([]*models.Tag, error)
- func (db *Database) GetUser(email string) (*models.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBClient ¶
type DBClient interface { // AddNewUser creates a new user in the database AddNewUser(u *models.User, e *models.EmailVerification) error // GetUser returns a user from the database with the given email GetUser(email string) (*models.User, error) // DeleteUser deletes a user from the database with the given email DeleteUser(email string) error // GetEmailVerification returns a pending email verification from the database // with the given email and hash GetEmailVerification(email string, hash string) (*models.EmailVerification, error) // AddNewClub creates a new club in the database with a user (creator) associated to it AddNewClub(c *models.Club, cu *models.ClubUser) error // GetClub returns a club with the given id GetClub(id string) (*models.Club, error) // GetAllClubUsers returns a list of ClubUsers associated with a club GetAllClubUsers(id string) ([]*models.ClubUser, error) // DeleteClub deletes a club from the database with the given id DeleteClub(id string) error // AddNewPeriod creates a new period item in the club table AddNewPeriod(clubID string, period *models.Period) error // AddNewEvent creates a new event in the club table AddNewEvent(clubID string, event *models.EventProps) error // GetEvent returns an event from the database GetEvent(clubID string, period string, eventID string) (*models.EventProps, error) // GetEvents returns all the events of an application period GetEvents(clubID string, period string) ([]*models.EventProps, error) // DeleteEvent deletes an event and all of its applications DeleteEvent(clubID string, period string, eventID string) error // AddNewApplicant creates a new applicant in the club table for an application period AddNewApplicant(clubID string, applicant *models.Applicant) error // GetApplicant returns an applicant for a application period GetApplicant(clubID string, period string, email string) (*models.Applicant, error) // GetApplicants returns all the applicants for an application period GetApplicants(clubID string, period string) ([]*models.Applicant, error) // DeleteApplicant deletes an applicant from a application period and their event applications DeleteApplicant(clubID string, period string, email string) error // AddNewApplication adds an application to the database AddNewApplication(clubID string, application *models.Application) error // GetApplication returns the application for an event by applicant email GetApplication(clubID string, period string, eventID string, email string) (*models.Application, error) // GetApplications returns all the applications for an event GetApplications(clubID string, period string, eventID string) ([]*models.Application, error) // DeleteApplication deletes the application for an event by applicant email DeleteApplication(clubID string, period string, eventID string, email string) error // AddTag adds a new Tag for that application period AddTag(clubID string, tag *models.Tag) error // GetTags returns all the tags for an application period GetTags(clubID string, period string) ([]*models.Tag, error) // DeleteTag deletes a tag for the application period DeleteTag(clubID string, period string, tag string) error }
DBClient wraps the AWS DynamoDB database API
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database handles database connections
func New ¶
func New(awsConfig client.ConfigProvider, logger *zap.SugaredLogger) (*Database, error)
New creates a new database client
func (*Database) AddNewApplicant ¶
AddNewApplicant creates a new applicant in the club table for an application period
func (*Database) AddNewApplication ¶
func (db *Database) AddNewApplication(clubID string, application *models.Application) error
AddNewApplication adds an application to the database
func (*Database) AddNewClub ¶
AddNewClub creates a new club in the database with a user (creator) associated to it
func (*Database) AddNewEvent ¶
func (db *Database) AddNewEvent(clubID string, event *models.EventProps) error
AddNewEvent creates a new event in the club table
func (*Database) AddNewPeriod ¶
AddNewPeriod creates a new period item in the club table
func (*Database) AddNewUser ¶
AddNewUser creates a new user in the database
func (*Database) DeleteApplicant ¶
DeleteApplicant deletes an applicant from a application period and their event applications
func (*Database) DeleteApplication ¶
func (db *Database) DeleteApplication(clubID string, period string, eventID string, email string) error
DeleteApplication deletes the application for an event by applicant email
func (*Database) DeleteClub ¶
DeleteClub deletes a club from the database with the given id
func (*Database) DeleteEvent ¶
DeleteEvent deletes an event and all of its applications
func (*Database) DeleteUser ¶
DeleteUser deletes a user from the database with the given email
func (*Database) GetAllClubUsers ¶
GetAllClubUsers returns a list of ClubUsers associated with a club
func (*Database) GetApplicant ¶
func (db *Database) GetApplicant(clubID string, period string, email string) (*models.Applicant, error)
GetApplicant returns an applicant for a application period
func (*Database) GetApplicants ¶
GetApplicants returns all the applicants for an application period
func (*Database) GetApplication ¶
func (db *Database) GetApplication(clubID string, period string, eventID string, email string) (*models.Application, error)
GetApplication returns the application for an event by applicant email
func (*Database) GetApplications ¶
func (db *Database) GetApplications(clubID string, period string, eventID string) ([]*models.Application, error)
GetApplications returns all the applications for an event
func (*Database) GetEmailVerification ¶
func (db *Database) GetEmailVerification(email string, hash string) (*models.EmailVerification, error)
GetEmailVerification returns a pending email verification from the database with the given email and hash
func (*Database) GetEvent ¶
func (db *Database) GetEvent(clubID string, period string, eventID string) (*models.EventProps, error)
GetEvent returns an event from the database