Documentation
¶
Index ¶
- Variables
- func ErrBadRequest(err error) render.Renderer
- func ErrConflict(err error) render.Renderer
- func ErrGateway(err error) render.Renderer
- func ErrInternalServer(err error) render.Renderer
- func ErrValidation(err error) render.Renderer
- func NewClientListResponse(clients []*model.Client) []render.Renderer
- func NewPagerListResponse(pagers []*model.Pager) []render.Renderer
- func NewPatientListResponse(patients []*model.Patient) []render.Renderer
- func NewTokenListResponse(tokens []*model.Token) []render.Renderer
- type ClientListResponse
- type ClientResponse
- type ErrResponse
- type PagerListResponse
- type PagerResponse
- type PatientListResponse
- type PatientRequest
- type PatientResponse
- type TokenListResponse
- type TokenResponse
- type UserRequest
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = &ErrResponse{HTTPStatusCode: http.StatusNotFound, Message: http.StatusText(http.StatusNotFound)}
ErrNotFound represents a 404 error
ErrUnauthorized represents a 401 error
Functions ¶
func ErrBadRequest ¶
ErrBadRequest represents a 400 error
func ErrGateway ¶
ErrGateway represents a 504 error caused by unresponsive auxiliary servers
func ErrInternalServer ¶
ErrInternalServer represents a 500 error
func ErrValidation ¶
ErrValidation represents a 422 error caused by validation
func NewClientListResponse ¶
NewClientListResponse creates a new client list response from multiple client models
func NewPagerListResponse ¶
NewPagerListResponse creates a new pager list response from multiple pager models
func NewPatientListResponse ¶
NewPatientListResponse creates a new patient list response from multiple patient models
Types ¶
type ClientListResponse ¶
type ClientListResponse []*ClientResponse
ClientListResponse is the list response payload for the client data model
type ClientResponse ¶
ClientResponse is the response payload for the client data model
func NewClientResponse ¶
func NewClientResponse(client *model.Client) *ClientResponse
NewClientResponse creates a new client response from client model
func (*ClientResponse) Render ¶
func (cr *ClientResponse) Render(w http.ResponseWriter, req *http.Request) error
Render preprocesses the response before marshalling
type ErrResponse ¶
type ErrResponse struct { Err error `json:"-"` // low-level runtime error HTTPStatusCode int `json:"status"` // http renderer status code Message string `json:"message"` // user-level status message ErrorText string `json:"error,omitempty"` // application-level error message, for debugging }
ErrResponse renderer type for handling all sorts of errors.
func (*ErrResponse) Render ¶
func (e *ErrResponse) Render(w http.ResponseWriter, req *http.Request) error
Render renders the ErrResponse
type PagerListResponse ¶
type PagerListResponse []*PagerResponse
PagerListResponse is the list response payload for the pager data model
type PagerResponse ¶
PagerResponse is the response payload for the pager data model
func NewPagerResponse ¶
func NewPagerResponse(pager *model.Pager) *PagerResponse
NewPagerResponse creates a new pager response from pager model
func (*PagerResponse) Render ¶
func (pr *PagerResponse) Render(w http.ResponseWriter, req *http.Request) error
Render preprocesses the response before marshalling
type PatientListResponse ¶
type PatientListResponse []*PatientResponse
PatientListResponse is the list response payload for the patient data model
type PatientRequest ¶
type PatientRequest struct { ID uint `json:"id"` SocialSecurityNo string `json:"ssn"` Name string `json:"name"` PagerID uint `json:"pagerId"` ClientID uint `json:"clientId"` Status string `json:"status"` Active bool `json:"active"` }
PatientRequest is the request payload for patient data model
func (*PatientRequest) Bind ¶
func (pr *PatientRequest) Bind(r *http.Request) error
Bind postprocesses the decoding of the request body
func (*PatientRequest) GetModel ¶
func (pr *PatientRequest) GetModel() *model.Patient
GetModel returns a Patient model
type PatientResponse ¶
type PatientResponse struct { ID uint `json:"id"` SocialSecurityNo string `json:"ssn"` Name string `json:"name"` PagerID uint `json:"pagerId,omitempty"` ClientID uint `json:"clientId"` Status string `json:"status"` Active bool `json:"active"` }
PatientResponse is the response payload for the patient data model
func NewPatientResponse ¶
func NewPatientResponse(patient *model.Patient) *PatientResponse
NewPatientResponse creates a new patient response from patient model
func (*PatientResponse) Render ¶
func (pr *PatientResponse) Render(w http.ResponseWriter, r *http.Request) error
Render preprocesses the response before marshalling
type TokenListResponse ¶
type TokenListResponse []*TokenResponse
TokenListResponse is the list response payload for the token data model
type TokenResponse ¶
type TokenResponse struct {
Token string `json:"token"`
}
TokenResponse is the response payload for the token data model
func NewTokenResponse ¶
func NewTokenResponse(token *model.Token) *TokenResponse
NewTokenResponse creates a new token response from token model
func (*TokenResponse) Render ¶
func (cr *TokenResponse) Render(w http.ResponseWriter, req *http.Request) error
Render preprocesses the response before marshalling
type UserRequest ¶
UserRequest is the request payload for user data model
func (*UserRequest) Bind ¶
func (pr *UserRequest) Bind(r *http.Request) error
Bind postprocesses the decoding of the request body
func (*UserRequest) GetModel ¶
func (pr *UserRequest) GetModel() *model.User
GetModel returns a User model