db

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

func New

func New(skylb skylab.Skylab) DB

func (DB) CreateTeam

func (d DB) CreateTeam(team skylab.Team) (skylab.Team, error)

func (DB) CreateUser

func (d DB) CreateUser(user skylab.User) (skylab.User, error)

CreateUser creates a new user in the database, returning the uid of the user.

The only fields it needs to read from are user.Displayname and user.Email.

It is idempotent and safe to call on the same user multiple times.

func (DB) CreateUserWithRoles

func (d DB) CreateUserWithRoles(user skylab.User, cohort string) (skylab.User, error)

CreateUserWithRoles will create a user like Skylab.CreateUser, but it will also create new roles for every role specified in user.Roles. It returns the uid of the created user as well as the urids for each user role that was created.

The fields it reads from are user.Displayname, user.Email and user.Roles.

It is idempotent and safe to call on a user multiple times.

func (DB) CustomPeriodOrder

func (d DB) CustomPeriodOrder() (orderby string, err error)

CustomPeriodOrder generates a custom ORDER BY clause based on the current milestones and stages in the database. Periods with an empty milestone come first, followed by periods ordered in milestone_enum order. Within each milestone group, periods will be ordered in stage_enum order. This custom ORDER BY is only possible thanks to the wonderful hack described in https://stackoverflow.com/q/4088532

func (DB) GetAdviserMentorEvaluationsByTsid

func (d DB) GetAdviserMentorEvaluationsByTsid(tsid int) (adviserEvaluation, mentorEvaluation skylab.UserEvaluation, err error)

func (DB) GetAdviserMentorFeedbackByTid added in v0.2.0

func (d DB) GetAdviserMentorFeedbackByTid(tid int) (adviserFeedback, mentorFeedback skylab.UserFeedback, err error)

func (DB) GetFormdataByFdid

func (d DB) GetFormdataByFdid(fdid int) (skylab.Formdata, error)

func (DB) GetFormdataByFsid

func (d DB) GetFormdataByFsid(fsid int) (skylab.Formdata, error)

func (DB) GetFsid

func (d DB) GetFsid(cohort, stage, milestone, name, subsection string) (fsid int, err error)

func (DB) GetPeriodByPid

func (d DB) GetPeriodByPid(pid int) (skylab.Period, error)

func (DB) GetQuestions

func (d DB) GetQuestions(cohort, stage, milestone, name, subsection string) (period skylab.Period, fsid int, questions formx.Questions, err error)

func (DB) GetStudentsByTid

func (d DB) GetStudentsByTid(tid int) (student1, student2 skylab.User, err error)

func (DB) GetSubmissionByTsid

func (d DB) GetSubmissionByTsid(tsid int) (skylab.Submission, error)

func (DB) GetTeamByStudentUrid

func (d DB) GetTeamByStudentUrid(urid int) (skylab.Team, error)

func (DB) GetTeamByTid

func (d DB) GetTeamByTid(tid int) (skylab.Team, error)

func (DB) GetTeamEvaluationByTesid

func (d DB) GetTeamEvaluationByTesid(tesid int) (skylab.TeamEvaluation, error)

func (DB) GetTeamEvaluationsByTsid

func (d DB) GetTeamEvaluationsByTsid(tsid int) ([]skylab.TeamEvaluation, error)

func (DB) GetTeamFeedbackByEvaluatorEvaluatee

func (d DB) GetTeamFeedbackByEvaluatorEvaluatee(evaluatorTid, evaluateeTid int) (skylab.TeamFeedback, error)

func (DB) GetTeamFeedbackByTftid

func (d DB) GetTeamFeedbackByTftid(tftid int) (skylab.TeamFeedback, error)

func (DB) GetTeamsByAdviserUrid

func (d DB) GetTeamsByAdviserUrid(urid int) ([]skylab.Team, error)

func (DB) GetTeamsByMentorUrid

func (d DB) GetTeamsByMentorUrid(urid int) ([]skylab.Team, error)

func (DB) GetUserByUid

func (d DB) GetUserByUid(uid int) (skylab.User, error)

func (DB) GetUserByUrid

func (d DB) GetUserByUrid(urid int) (user skylab.User, role string, err error)

func (DB) GetUserEvaluationByUesid

func (d DB) GetUserEvaluationByUesid(uesid int) (skylab.UserEvaluation, error)

func (DB) GetUserFeedbackByEvaluatorEvaluatee added in v0.2.0

func (d DB) GetUserFeedbackByEvaluatorEvaluatee(evaluatorTid, evaluateeUrid int) (skylab.UserFeedback, error)

func (DB) GetUserFeedbackByTfuid added in v0.2.0

func (d DB) GetUserFeedbackByTfuid(tfuid int) (skylab.UserFeedback, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL