Documentation ¶
Index ¶
- type Class
- type ClassReport
- type ClassRepository
- func (cr *ClassRepository) Class(classID string) (*Class, error)
- func (cr *ClassRepository) Classes(hasReport *bool) ([]*Class, error)
- func (cr *ClassRepository) Create(className string, subjects []*Subject) (string, error)
- func (cr *ClassRepository) Exists(classID string) (bool, error)
- func (cr *ClassRepository) SaveClassReport(classID string, report *ClassReport) error
- type Repository
- type Subject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Class ¶
type Class struct { ID string `json:"_id" bson:"_id"` Name string `json:"name" bson:"name"` Subjects []*Subject `json:"subjects" bson:"subjects"` Report *ClassReport `json:"report" bson:"report"` // nil until a report is generated CreatedAt string `json:"createdAt" bson:"createdAt"` LastUpdatedAt string `json:"lastUpdatedAt" bson:"lastUpdatedAt"` }
type ClassReport ¶
type ClassReport struct { TotalStudents int `json:"totalStudents" bson:"totalStudents"` HighestStudentScore int `json:"highestStudentScore" bson:"highestStudentScore"` HighestStudentScoreAsPercentage string `json:"highestStudentScoreAsPercentage" bson:"highestStudentScoreAsPercentage"` LowestStudentScore int `json:"lowestStudentScore" bson:"lowestStudentScore"` LowestStudentScoreAsPercentage string `json:"lowestStudentScoreAsPercentage" bson:"lowestStudentScoreAsPercentage"` GeneratedAt string `json:"generatedAt" bson:"generatedAt"` }
type ClassRepository ¶
type ClassRepository struct {
// contains filtered or unexported fields
}
func (*ClassRepository) Class ¶
func (cr *ClassRepository) Class(classID string) (*Class, error)
Class returns information for the class that match the provided classID. Implements Repository.
func (*ClassRepository) Classes ¶
func (cr *ClassRepository) Classes(hasReport *bool) ([]*Class, error)
Classes returns information for all the classes in the database. Implements Repository.
func (*ClassRepository) Create ¶
func (cr *ClassRepository) Create(className string, subjects []*Subject) (string, error)
Create creates a new class in the database. Returns db.ErrorInvalidRequest is the provided class name matches any record in the database. Implements Repository.
func (*ClassRepository) Exists ¶
func (cr *ClassRepository) Exists(classID string) (bool, error)
Exists checks if classID exists. Implements Repository.
func (*ClassRepository) SaveClassReport ¶
func (cr *ClassRepository) SaveClassReport(classID string, report *ClassReport) error
SaveClassReport saves a newly generated class report for the class that match the provided classID. Implements Repository.
type Repository ¶
type Repository interface { // Create creates a new class in the database. Returns // db.ErrorInvalidRequest is the provided class name matches any record in // the database. Create(className string, subjects []*Subject) (string, error) // Class returns information for the class that match the provided classID. Class(classID string) (*Class, error) // Classes returns information for all the classes in the database. Set // hasReport to filter classes by report. Classes(hasReport *bool) ([]*Class, error) // Exists checks if classID exists. Exists(classID string) (bool, error) // SaveClassReport saves a newly generated class report for the class that // match the provided classID. SaveClassReport(classID string, report *ClassReport) error }
func NewRepository ¶
NewRepository creates a new instance of *ClassRepository.
Click to show internal directories.
Click to hide internal directories.