dbhandler

package
v0.0.0-...-4674b8d Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2017 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MAX_STUDENT_PER_TEAM = 4
)
View Source
const (
	Session_Collection_Name = "Session"
)
View Source
const (
	Solution_Collection_Name = "Solutions"
)

Variables

View Source
var (
	POSTGRES_HOST     = os.Getenv("POSTGRES_HOST")
	POSTGRES_DB       = os.Getenv("POSTGRES_DB")
	POSTGRES_USER     = os.Getenv("POSTGRES_USER")
	POSTGRES_PASSWORD = os.Getenv("POSTGRES_PASSWORD")
)
View Source
var (
	MONGO_DB_HOST           = os.Getenv("MONGO_DB_HOST")
	MONGO_DB_USER           = os.Getenv("MONGO_DB_USER")
	MONGO_DB_PASSWORD       = os.Getenv("MONGO_DB_PASSWORD")
	MONGO_AUTH_DB           = os.Getenv("MONGO_DB_AUTH_DB")
	Problem_Collection_Name = "Problems"
)

TODO: Read from config file

Functions

func AddressCreate

func AddressCreate(address models.Address) int64

* Address

func AddressDelete

func AddressDelete(address_id int64) int64

func AddressRead

func AddressRead(address_id int64) models.Address

func AddressUpdate

func AddressUpdate(address models.Address) int64

func AdvisorCreate

func AdvisorCreate(advisor models.Advisor) int64

Advisor

func AdvisorDelete

func AdvisorDelete(advisor_id int64) int64

func AdvisorGetAllSchools

func AdvisorGetAllSchools(advisor_id int64) []int64

* Given an AdvisorID, find all Schools

func AdvisorRead

func AdvisorRead(advisor_id int64) models.Advisor

func AdvisorReadAll

func AdvisorReadAll() []*models.Advisor

func AdvisorReadByEmail

func AdvisorReadByEmail(email string) models.Advisor

func AdvisorUpdate

func AdvisorUpdate(advisor models.Advisor) int64

func CredentialCreate

func CredentialCreate(credential models.Credential) int64

* Credential

*

func CredentialDelete

func CredentialDelete(emailaddress string) int64

func CredentialRead

func CredentialRead(emailaddress string) *models.Credential

func CredentialUpdate

func CredentialUpdate(emailaddress string, password string, credential_active bool) int64

func FindAddress

func FindAddress(address_zip *string, address_line1 *string) models.Address

* Given zipcode and address line 1 we should be able to find an address. We assume that unlike houses/apartments there cannot be two schools at same zip code (state and city) and same address line1.

func ProblemCreate

func ProblemCreate(problem models.Problem) models.Error

Problem

For experiment purpose, create return an model.Error instead of error code. We want to see if that helps in reducing the logic at requesthandler side.

func ProblemDelete

func ProblemDelete(problem_id int64) int64

func ProblemRead

func ProblemRead(problem_id int64) models.Problem

func ProblemReadList

func ProblemReadList() []*models.Problem

func ProblemUpdate

func ProblemUpdate(problem models.Problem) int64

func SchoolAddAdvisor

func SchoolAddAdvisor(school_id int64, advisor_id int64) bool

*

SchoolAddAdvisor adds an Advisor to a School

func SchoolCreate

func SchoolCreate(school models.School) int64

School

func SchoolDelete

func SchoolDelete(school_id int64) int64

func SchoolDeleteAdvisor

func SchoolDeleteAdvisor(school_id int64, advisor_id int64) bool

* SchoolDeleteAdvisor deletes an Advisor from a School

func SchoolList

func SchoolList(params school.GetSchoolParams) []*models.School

func SchoolRead

func SchoolRead(school_id int64) models.School

func SchoolReadAdvisor

func SchoolReadAdvisor(school_id int64) int64

* Given a school_id, get the advisor for the School.

func SchoolUpdate

func SchoolUpdate(school models.School) int64

func SessionCreate

func SessionCreate(principal *models.Principal) models.Error

func SessionDelete

func SessionDelete(email string) int64

func SessionRead

func SessionRead(email string) *models.Principal

func SolutionCreate

func SolutionCreate(solution models.Solution) int64

Solution

func SolutionDelete

func SolutionDelete(solution_id int64) int64

func SolutionForProblem

func SolutionForProblem(problem_id int64) []*models.Solution

* Given an ProblemID find all related solutions.

func SolutionRead

func SolutionRead(solution_id int64) models.Solution

func SolutionUpdate

func SolutionUpdate(solution models.Solution) int64

func StudentCreate

func StudentCreate(student models.Student) int64

* Create a Student

func StudentDelete

func StudentDelete(student_id int64) int64

func StudentListBySchool

func StudentListBySchool(school_id int64) []*models.Student

* StudentListBySchool Finds and returns all Student who belongs to a School

func StudentRead

func StudentRead(student_id int64) models.Student

func StudentUpdate

func StudentUpdate(student models.Student) int64

func TeamAddMember

func TeamAddMember(team_id int64, student_id int64) bool

Add a Student to a team

func TeamCreate

func TeamCreate(team models.Team) int64

Team

func TeamDelete

func TeamDelete(team_id int64) int64

func TeamDeleteMember

func TeamDeleteMember(team_id int64, student_id int64) bool

func TeamListForSchool

func TeamListForSchool(school_id int64) []int64

* Get the list of Teams for a School

func TeamRead

func TeamRead(team_id int64) models.Team

func TeamReadMembers

func TeamReadMembers(team_id int64) []int64

func TeamUpdate

func TeamUpdate(team models.Team) int64

Types

This section is empty.

Jump to

Keyboard shortcuts

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