Documentation ¶
Index ¶
- Variables
- func Connect(opts r.ConnectOpts) error
- func DeleteNote(id string) error
- func DeletePaper(id string) error
- func NewNote(title string) (string, error)
- func NewPaper(title, subject string, year int) (string, error)
- func SetNoteStar(id, username string, starred bool) error
- func SetPaperCompleted(id, username string, completed bool) error
- func UpdateNote(note Note) error
- func UpdatePaper(paper Paper) error
- func UpdatePassword(username, hash string) error
- func UpdateScheduleByMatch(username string, schedule []string) error
- type FullNote
- type FullPaper
- type FullSubject
- type Note
- type Paper
- type Schedule
- type Subject
- type User
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("airlift: not found")
ErrNotFound is the error that is returned if the document being queried could not be found.
Functions ¶
func NewNote ¶
NewNote creates a new note and returns a unique human friendly ID. Data must be populated using UpdateNote.
func NewPaper ¶
NewPaper creates a new paper and returns a unique human friendly ID. Data must be populated using UpdatePaper.
func SetNoteStar ¶
SetNoteStar sets the status of a note's star.
func SetPaperCompleted ¶
SetPaperCompleted marks a practice paper as completed for a user.
func UpdatePaper ¶
UpdatePaper updates the information of a paper
func UpdatePassword ¶
UpdatePassword updates the password of a user with the given hash.
func UpdateScheduleByMatch ¶
UpdateScheduleByMatch updates a user's schedule by using prefix matching based on data from app4.
Types ¶
type FullNote ¶
type FullNote struct { Note UploaderName string `gorethink:"uploader_name"` SubjectName string `gorethink:"subject_name"` }
FullNote represents a note with some additional data.
func GetFullNote ¶
GetFullNote returns a note and some additional data given its ID.
type FullPaper ¶
type FullPaper struct { Paper UploaderName string `gorethink:"uploader_name"` SubjectName string `gorethink:"subject_name"` }
FullPaper represents a user uploaded paper with additional data
func GetCompletedPapers ¶
GetCompletedPapers returns the papers completed by a user.
func GetFullPaper ¶
GetFullPaper returns the paper with additional data uploaded by a user.
func GetUploadedPapers ¶
GetUploadedPapers returns the papers uploaded by a user.
type FullSubject ¶
type FullSubject struct { Subject Notes []Note `gorethink:"notes"` Papers []Paper `gorethink:"papers"` }
FullSubject represents a subject along with notes and practice exams.
func GetFullSubject ¶
func GetFullSubject(id, username string) (FullSubject, error)
GetFullSubject returns a subject along with its notes ordered by stars and papers ordered by publication year.
type Note ¶
type Note struct { ID string `gorethink:"id"` Title string `gorethink:"title"` Subject string `gorethink:"subject"` Author string `gorethink:"author"` Uploader string `gorethink:"uploader"` Public bool `gorethink:"public"` Stars []string `gorethink:"stars"` Size uint64 `gorethink:"size,omitempty"` HasStarred bool `gorethink:"has_starred,omitempty"` NumStars int `gorethink:"num_stars,omitempty"` UpdatedTime time.Time `gorethink:"updated_time,omitempty"` UploadTime time.Time `gorethink:"upload_time,omitempty"` }
Note represents a user uploaded note file.
func GetStarredNotes ¶
GetStarredNotes returns the notes starred by a user.
func GetUploadedNotes ¶
GetUploadedNotes returns the notes uploaded by a user.
type Paper ¶
type Paper struct { ID string `gorethink:"id"` Title string `gorethink:"title"` Year int `gorethink:"year"` Subject string `gorethink:"subject"` Author string `gorethink:"author"` Public bool `gorethink:"public"` Completed []string `gorethink:"completed"` Uploader string `gorethink:"uploader"` SolutionsSize uint64 `gorethink:"solutions_size,omitempty"` SourceSize uint64 `gorethink:"source_size,omitempty"` QuestionsSize uint64 `gorethink:"questions_size,omitempty"` HasCompleted bool `gorethink:"has_completed,omitempty"` NumCompleted int `gorethink:"num_completed,omitempty"` UpdatedTime time.Time `gorethink:"updated_time,omitempty"` UploadTime time.Time `gorethink:"upload_time,omitempty"` }
Paper represents a user uploaded paper
type Schedule ¶
type Schedule []Subject
Schedule represents the schedule for a user.
func GetAlphaScheduleFor ¶
GetAlphaScheduleFor returns the schedule for a user sorted by alphabetical order for use in selections.
func GetScheduleFor ¶
GetScheduleFor returns the schedule for a user.
type Subject ¶
type Subject struct { ID string `gorethink:"id"` Name string `gorethink:"name"` Match string `gorethink:"match"` ExamTime time.Time `gorethink:"exam_time"` }
Subject represents a subject and its information.
func AllSubjects ¶
AllSubjects returns all of the subjects in the database in alphabetical order.
func GetSubject ¶
GetSubject returns the basic information of a subject.
type User ¶
type User struct { Name string `gorethink:"name"` Username string `gorethink:"username"` Email string `gorethink:"email"` Password string `gorethink:"password,omitempty"` Schedule []string `gorethink:"schedule,omitempty"` RawSchedule []string `gorethink:"raw_schedule,omitempty"` }
User represents a user.