models

package
v0.0.0-...-204c8b9 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Course

type Course struct {
	// Name of the course
	// required: true
	Name string `json:"name" bson:"name" validate:"required"`

	// Code for the course
	// required: true
	Code string `json:"code" bson:"code" validate:"required"`

	// Number of credits for the course
	// required: true
	// min: 1
	Credits int `json:"course_credits" bson:"course_credits" validate:"required,gt=0"`

	// Grade received by the student
	// required: true
	Grade string `json:"grade" bson:"grade" validate:"required"`
}

Course defines the structure of a course swagger:model

type ErrorResponse

type ErrorResponse struct {
	// Status of the response
	Status int `json:"status"`

	// Error message
	Message string `json:"message"`

	// Content to displayed along with the message
	Content interface{} `json:"content"`
}

Response for returning an error message swagger:model

func NewErrorResponse

func NewErrorResponse(status int, message string, content interface{}) *ErrorResponse

NewErrorResponse will return new instance of ErrorResponse

type PaginatedResponse

type PaginatedResponse struct {
	// Status of the response
	Status int `json:"status"`

	// Message in the response
	Message string `json:"message"`

	// Count of students in response
	// maximum: 100
	// minimum: 0
	Count int `json:"count"`

	// Path to fetch the students next in the list
	Next string `json:"next"`

	// Path to fetch the students before the items currently in the list
	Previous string `json:"previous"`

	// List of students
	// collection format: Student
	Students []Student `json:"results"`
}

Response for returning a list of students swagger:model

func NewPaginatedResponse

func NewPaginatedResponse(status, count int, message, next, prev string, students []Student) *PaginatedResponse

NewPaginatedResponse will return new instance of PaginatedResponse

type Response

type Response struct {
	// Status of the response
	Status int `json:"status"`

	// Message in the response
	Message string `json:"message"`

	// Student to be displayed
	Student Student `json:"student"`
}

Response for returning a single student swagger:model

func NewResponse

func NewResponse(status int, message string, student Student) *Response

NewResponse will return new instance of Response

type Semester

type Semester struct {
	// Semester number
	// required: true
	Number int `json:"number" bson:"number" validate:"required"`

	// Credits earned by the student in that semester
	// required: true
	// min: 1
	Credits int `json:"earned_credits" bson:"earned_credits" validate:"required,gt=0"`

	// SGPA earned for the semester by the student
	// required: true
	SGPA float32 `json:"sgpa" bson:"sgpa" validate:"required"`

	// CGPA after this semester
	// required: true
	CGPA float32 `json:"cgpa" bson:"cgpa" validate:"required"`

	// Information about courses taken by the student in the semester
	// required: true
	Courses []Course `json:"courses" bson:"courses" validatre:"required,dive"`
}

Semester defines the structure of a semester swagger:model

type Student

type Student struct {
	// Roll number of student
	// required: true
	Roll string `json:"roll_no" bson:"roll_no" validate:"required,numeric,len=9"`

	// Name of the student
	// required: true
	Name string `json:"name" bson:"name" validate:"required"`

	// Program in which the student is enrolled in
	// required: true
	Program string `json:"program" bson:"program" validate:"required"`

	// Branch of the student
	// required: true
	Branch string `json:"branch" bson:"branch" validate:"required"`

	// Current CGPA of the student
	// required: true
	CGPA float32 `json:"cgpa" bson:"cgpa" validate:"required"`

	// Information about the previous semesters of a student
	// required: true
	Semesters []Semester `json:"semesters" bson:"semesters" validate:"required,dive"`

	// Time at which the instance was created in the database
	// required: false
	// read only: true
	CreatedAt time.Time `json:"created_at" bson:"created_at"`

	// Time at which the student instance was last updated in the database
	// required: false
	// read only: true
	UpdatedAt time.Time `json:"updated_at" bson:"updated_at"`
}

Student defines the structure of a student swagger:model

Jump to

Keyboard shortcuts

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