model

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2014 License: GPL-2.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPassword = errors.New("Username or password incorrect.")
)

Functions

func RequiredErr

func RequiredErr(fieldName string) binding.Error

Types

type Assignment

type Assignment struct {
	ID      string         `gorethink:"id,omitempty"json:"id"`
	ClassID string         `gorethink:"classId,omitempty"json:"classId"`
	TermID  string         `gorethink:"termId,omitempty"json:"termId"`
	TypeID  string         `gorethink:"typeId,omitempty"json:"typeId"`
	Name    string         `gorethink:"name,omitempty"json:"name"`
	Type    AssignmentType `gorethink:"type,omitempty"json:"type"`
	DueDate time.Time      `gorethink:"dueDate,omitempty"json:"dueDate"`
	TimeStamp
}

Assignment ...

func (*Assignment) FieldMap

func (a *Assignment) FieldMap() binding.FieldMap

FieldMap ...

func (Assignment) Validate

func (a Assignment) Validate(req *http.Request, errs binding.Errors) binding.Errors

type AssignmentGrade

type AssignmentGrade struct {
	ID           string `gorethink:"id,omitempty"json:"id"`
	AssignmentID string `gorethink:"assignmentId,omitempty"json:"assignmentId"`
	PersonID     string `gorethink:"personId,omitempty"json:"personId"`
	Grade        string `gorethink:"grade,omitempty"json:"grade"`
	TimeStamp
}

AssignmentGrade ...

func (*AssignmentGrade) FieldMap

func (a *AssignmentGrade) FieldMap() binding.FieldMap

FieldMap ...

func (AssignmentGrade) Validate

func (a AssignmentGrade) Validate(req *http.Request, errs binding.Errors) binding.Errors

type AssignmentType

type AssignmentType struct {
	ID         string   `gorethink:"id,omitempty"json:"id"`
	Name       string   `gorethink:"name,omitempty"json:"name"`
	Weight     float64  `gorethink:"weight,omitempty"json:"weight"`
	SubjectIDs []string `gorethink:"subjectIDs,omitempty"json:"subjectIDs,omitempty"`
	MaxScore   int16    `gorethink:"maxScore,omitempty"json:"maxScore"`
	TimeStamp
}

AssignmentType ...

func (*AssignmentType) FieldMap

func (a *AssignmentType) FieldMap() binding.FieldMap

FieldMap ...

func (AssignmentType) Validate

func (a AssignmentType) Validate(req *http.Request, errs binding.Errors) binding.Errors

Validate ...

type Class

type Class struct {
	ID          string   `gorethink:"id,omitempty"json:"id"`
	Name        string   `gorethink:"name,omitempty"json:"name"`
	GradeLevel  string   `gorethink:"gradeLevel,omitempty"json:"gradeLevel"`
	Subject     string   `gorethink:"subject,omitempty"json:"subject"`
	MaxStudents int      `gorethink:"maxStudents,omitempty"json:"maxStudents"`
	Terms       []string `gorethink:"terms"json:"terms,omitempty"`
	TimeStamp
}

func (*Class) FieldMap

func (c *Class) FieldMap() binding.FieldMap

func (Class) Validate

func (c Class) Validate(req *http.Request, errs binding.Errors) binding.Errors

type Enrollment

type Enrollment struct {
	ID       string `gorethink:"id,omitempty"json:"id"`
	PersonID string `gorethink:"personId,omitempty"json:"personId"`
	ClassID  string `gorethink:"classId,omitempty"json:"classId"`
	TermID   string `gorethink:"termId,omitempty"json:"termId"`
	TimeStamp
}

func (*Enrollment) FieldMap

func (e *Enrollment) FieldMap() binding.FieldMap

func (Enrollment) Validate

func (e Enrollment) Validate(req *http.Request, errs binding.Errors) binding.Errors

type EnrollmentAPIRes

type EnrollmentAPIRes struct {
	ID       string `gorethink:"id,omitempty"json:"id"`
	PersonID string `gorethink:"personId,omitempty"json:"personId"`
	ClassID  string `gorethink:"classId,omitempty"json:"classId"`
	TermID   string `gorethink:"termId,omitempty"json:"termId"`
	Person   Person `gorethink:"person,omitempty"json:"person"`
	TimeStamp
}

type Model

type Model interface {
	UpdateTime()
}

type Person

type Person struct {
	ID          string   `gorethink:"id,omitempty"json:"id"`
	FirstName   string   `gorethink:"firstName,omitempty"json:"firstName,omitempty"`
	MiddleName  string   `gorethink:"middleName,omitempty"json:"middleName,omitempty"`
	LastName    string   `gorethink:"lastName,omitempty"json:"lastName,omitempty"`
	Types       []string `gorethink:"types,omitempty"json:"types,omitempty"`
	GradeLevel  string   `gorethink:"gradeLevel,omitempty"json:"gradeLevel"`
	PhoneNumber string   `gorethink:"phoneNumber,omitempty"json:"personId"`
	Email       string   `gorethink:"email,omitempty"json:"email"`
	TimeStamp
}

func (*Person) FieldMap

func (p *Person) FieldMap() binding.FieldMap

func (Person) Validate

func (p Person) Validate(req *http.Request, errs binding.Errors) binding.Errors

type Session

type Session struct {
	ID        string    `gorethink:"id,omitempty"json:"id"`
	Token     string    `gorethink:"token"json:"token"`
	UserID    string    `gorethink:"userId"json:"userId"`
	ExpiresAt time.Time `gorethink:"expiresAt"json:"expiresAt"`
	TimeStamp
}

func NewSession

func NewSession(u User) (Session, error)

Create a token for the user after we verified their password.

type Term

type Term struct {
	ID         string    `gorethink:"id,omitempty"json:"id"`
	Name       string    `gorethink:"name,omitempty"json:"name"`
	SchoolYear string    `gorethink:"schoolYear,omitempty"json:"schoolYear"`
	StartDate  time.Time `gorethink:"startDate,omitempty"json:"startDate"`
	EndDate    time.Time `gorethink:"endDate,omitempty"json:"endDate"`
	TimeStamp
}

func (*Term) FieldMap

func (t *Term) FieldMap() binding.FieldMap

func (Term) Validate

func (t Term) Validate(req *http.Request, errs binding.Errors) binding.Errors

type TimeStamp

type TimeStamp struct {
	CreatedAt time.Time `gorethink:"createdAt"json:"createdAt"`
	UpdatedAt time.Time `gorethink:"updatedAt"json:"updatedAt"`
}

func (*TimeStamp) UpdateTime

func (a *TimeStamp) UpdateTime()

type User

type User struct {
	ID             string `gorethink:"id,omitempty"json:"id"`
	Email          string `gorethink:"email,omitempty"json:"email"`
	EmailLower     string `gorethink:"emailLower,omitempty"json:"emailLower"`
	HashedPassword string `gorethink:"hashedPassword,omitempty"json:"-"`
	PersonID       string `gorethink:"personId,omitempty"json:"personId"`
	Role           string `gorethink:"role,omitempty"json:"role"`
	Disabled       bool   `gorethink:"disabled,omitempty"json:"disabled"`
	TimeStamp
}

func NewUserFor

func NewUserFor(email, password, personID string) (*User, error)

func (*User) ComparePassword

func (u *User) ComparePassword(password string) error

func (*User) SetPassword

func (u *User) SetPassword(password string) error

type ValError

type ValError struct {
	FieldNames []string `json:"fieldNames,omitempty"`
	Message    string   `json:"message,omitempty"`
}

func (ValError) Error

func (e ValError) Error() string

type ValErrors

type ValErrors []ValError

func (*ValErrors) Add

func (v *ValErrors) Add(fieldNames []string, message string)

func (*ValErrors) Len

func (v *ValErrors) Len() int

Jump to

Keyboard shortcuts

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