utils

package
v0.0.0-...-488514f Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound        = &ErrResponse{HTTPStatusCode: 404, StatusText: "Resource not found."}
	ErrBadRequest      = &ErrResponse{HTTPStatusCode: 400, StatusText: "Bad request"}
	ErrInternalServer  = &ErrResponse{HTTPStatusCode: 500, StatusText: "Internal Server Error"}
	ErrInvalidFacility = &ErrResponse{HTTPStatusCode: 400, StatusText: "Invalid facility"}
	ErrInvalidRole     = &ErrResponse{HTTPStatusCode: 400, StatusText: "Invalid role"}
	ErrInvalidCID      = &ErrResponse{HTTPStatusCode: 400, StatusText: "Invalid CID"}
)

Functions

func ErrConflict

func ErrConflict(err error) render.Renderer

func ErrInvalidRequest

func ErrInvalidRequest(err error) render.Renderer

func ErrRender

func ErrRender(err error) render.Renderer

func GetActionLogCtx

func GetActionLogCtx(r *http.Request) *models.ActionLogEntry

func GetDisciplinaryLogCtx

func GetDisciplinaryLogCtx(r *http.Request) *models.DisciplinaryLogEntry

func GetDocumentCtx

func GetDocumentCtx(r *http.Request) *models.Document

func GetFAQCtx

func GetFAQCtx(r *http.Request) *models.FAQ

func GetFacilityCtx

func GetFacilityCtx(r *http.Request) (*models.Facility, error)

func GetFacilityLogCtx

func GetFacilityLogCtx(r *http.Request) *models.FacilityLogEntry

func GetFeedbackCtx

func GetFeedbackCtx(r *http.Request) *models.Feedback

func GetNewsCtx

func GetNewsCtx(r *http.Request) *models.News

func GetNotificationCtx

func GetNotificationCtx(r *http.Request) *models.Notification

func GetRatingChangeCtx

func GetRatingChangeCtx(r *http.Request) *models.RatingChange

func GetRosterCtx

func GetRosterCtx(r *http.Request) *models.Roster

func GetRosterRequestCtx

func GetRosterRequestCtx(r *http.Request) *models.RosterRequest

func GetUserCtx

func GetUserCtx(r *http.Request) *models.User

func GetUserFlagCtx

func GetUserFlagCtx(r *http.Request) *models.UserFlag

func GetUserRoleCtx

func GetUserRoleCtx(r *http.Request) *models.UserRole

func Render

func Render(w http.ResponseWriter, r *http.Request, renderer render.Renderer)

Types

type AleKey

type AleKey struct{}

type DleKey

type DleKey struct{}

type DocumentKey

type DocumentKey struct{}

type ErrResponse

type ErrResponse struct {
	Err            error `json:"-"` // low-level runtime error
	HTTPStatusCode int   `json:"-"` // http response status code

	StatusText string `json:"status"`          // user-level status message
	AppCode    int64  `json:"code,omitempty"`  // application-specific error code
	ErrorText  string `json:"error,omitempty"` // application-level error message, for debugging
}

func (*ErrResponse) Render

func (e *ErrResponse) Render(w http.ResponseWriter, r *http.Request) error

type FAQKey

type FAQKey struct{}

type FacilityLogKey

type FacilityLogKey struct{}

type FeedbackKey

type FeedbackKey struct{}

type NewsKey

type NewsKey struct{}

type NotificationKey

type NotificationKey struct{}

type RatingChangeKey

type RatingChangeKey struct{}

type RosterKey

type RosterKey struct{}

type RosterRequestKey

type RosterRequestKey struct{}

type UserFlagKey

type UserFlagKey struct{}

type UserKey

type UserKey struct{}

type UserRoleKey

type UserRoleKey struct{}

Jump to

Keyboard shortcuts

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