Documentation ¶
Overview ¶
Package server is a generated GoMock package.
Index ¶
- func ClientVersionCheckMiddleware(h http.Handler, rng VersionRange) http.Handler
- func CompressionLevel(level int) func(*serverConfig)
- func NewRouter(c Controller) *mux.Router
- func PanicMiddleware(h http.Handler) http.Handler
- type Controller
- type MockController
- func (m *MockController) EXPECT() *MockControllerMockRecorder
- func (m *MockController) GetSectionsForStudent(ctx context.Context, studentID string) ([]models.Section, error)
- func (m *MockController) PostGradeFileForStudent(ctx context.Context, i *models.PostGradeFileForStudentInput) error
- func (m *MockController) PostSectionsForStudent(ctx context.Context, i *models.PostSectionsForStudentInput) ([]models.Section, error)
- type MockControllerMockRecorder
- type Server
- type VersionRange
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientVersionCheckMiddleware ¶
func ClientVersionCheckMiddleware(h http.Handler, rng VersionRange) http.Handler
ClientVersionCheckMiddleware checks the client version.
func CompressionLevel ¶
func CompressionLevel(level int) func(*serverConfig)
func NewRouter ¶
func NewRouter(c Controller) *mux.Router
NewRouter returns a mux.Router with no middleware. This is so we can attach additional routes to the router if necessary
Types ¶
type Controller ¶
type Controller interface { // PostGradeFileForStudent handles POST requests to /students/{student_id}/gradeFile // Posts the grade file for the specified student // 200: nil // 400: *models.BadRequest // 500: *models.InternalError // default: client side HTTP errors, for example: context.DeadlineExceeded. PostGradeFileForStudent(ctx context.Context, i *models.PostGradeFileForStudentInput) error // GetSectionsForStudent handles GET requests to /students/{student_id}/sections // Gets the sections for the specified student // 200: []models.Section // 400: *models.BadRequest // 500: *models.InternalError // default: client side HTTP errors, for example: context.DeadlineExceeded. GetSectionsForStudent(ctx context.Context, studentID string) ([]models.Section, error) // PostSectionsForStudent handles POST requests to /students/{student_id}/sections // Posts the sections for the specified student // 200: []models.Section // 400: *models.BadRequest // 500: *models.InternalError // default: client side HTTP errors, for example: context.DeadlineExceeded. PostSectionsForStudent(ctx context.Context, i *models.PostSectionsForStudentInput) ([]models.Section, error) }
Controller defines the interface for the blog service.
type MockController ¶
type MockController struct {
// contains filtered or unexported fields
}
MockController is a mock of Controller interface.
func NewMockController ¶
func NewMockController(ctrl *gomock.Controller) *MockController
NewMockController creates a new mock instance.
func (*MockController) EXPECT ¶
func (m *MockController) EXPECT() *MockControllerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockController) GetSectionsForStudent ¶
func (m *MockController) GetSectionsForStudent(ctx context.Context, studentID string) ([]models.Section, error)
GetSectionsForStudent mocks base method.
func (*MockController) PostGradeFileForStudent ¶
func (m *MockController) PostGradeFileForStudent(ctx context.Context, i *models.PostGradeFileForStudentInput) error
PostGradeFileForStudent mocks base method.
func (*MockController) PostSectionsForStudent ¶
func (m *MockController) PostSectionsForStudent(ctx context.Context, i *models.PostSectionsForStudentInput) ([]models.Section, error)
PostSectionsForStudent mocks base method.
type MockControllerMockRecorder ¶
type MockControllerMockRecorder struct {
// contains filtered or unexported fields
}
MockControllerMockRecorder is the mock recorder for MockController.
func (*MockControllerMockRecorder) GetSectionsForStudent ¶
func (mr *MockControllerMockRecorder) GetSectionsForStudent(ctx, studentID interface{}) *gomock.Call
GetSectionsForStudent indicates an expected call of GetSectionsForStudent.
func (*MockControllerMockRecorder) PostGradeFileForStudent ¶
func (mr *MockControllerMockRecorder) PostGradeFileForStudent(ctx, i interface{}) *gomock.Call
PostGradeFileForStudent indicates an expected call of PostGradeFileForStudent.
func (*MockControllerMockRecorder) PostSectionsForStudent ¶
func (mr *MockControllerMockRecorder) PostSectionsForStudent(ctx, i interface{}) *gomock.Call
PostSectionsForStudent indicates an expected call of PostSectionsForStudent.
type Server ¶
type Server struct { // Handler should generally not be changed. It exposed to make testing easier. Handler http.Handler // contains filtered or unexported fields }
Server defines a HTTP server that implements the Controller interface.
func AttachMiddleware ¶
func AttachMiddleware(router *mux.Router, addr string, m []func(http.Handler) http.Handler, options ...func(*serverConfig)) *Server
AttachMiddleware attaches the given middleware to the router; this is to be used in conjunction with NewServer. It attaches custom middleware passed as arguments as well as the built-in middleware for logging, tracing, and handling panics. It should be noted that the built-in middleware executes first followed by the passed in middleware (in the order specified).
func New ¶
func New(c Controller, addr string, options ...func(*serverConfig)) *Server
New returns a Server that implements the Controller interface. It will start when "Serve" is called.
func NewWithMiddleware ¶
func NewWithMiddleware(c Controller, addr string, m []func(http.Handler) http.Handler, options ...func(*serverConfig)) *Server
NewWithMiddleware returns a Server that implemenets the Controller interface. It runs the middleware after the built-in middleware (e.g. logging), but before the controller methods. The middleware is executed in the order specified. The server will start when "Serve" is called.
type VersionRange ¶
VersionRange decides whether to accept a version.