Documentation ¶
Index ¶
- Variables
- func ErrInvalidRequest(err error) render.Renderer
- func ErrRender(err error) render.Renderer
- func ErrUnauthorized(err error) render.Renderer
- func LoggingMiddleware(ctx context.Context) func(next http.Handler) http.Handler
- func Start(ctx context.Context)
- func UserAPIKeyAuthMiddleware(next http.Handler) http.Handler
- type ErrResponse
- type HTTPWriter
- func (rwc *HTTPWriter) Close() error
- func (rwc *HTTPWriter) Flush()
- func (w *HTTPWriter) GetObjects() []*response_object_structs.ResponseObject
- func (rwc *HTTPWriter) Header() http.Header
- func (w *HTTPWriter) SetPreWriteCallback(fn func())
- func (rwc *HTTPWriter) Write(p []byte) (n int, err error)
- func (rwc *HTTPWriter) WriteHeader(statusCode int)
- func (rwc *HTTPWriter) WriteObject(obj *response_object_structs.ResponseObject) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = &ErrResponse{HTTPStatusCode: 404, StatusText: "Resource not found."}
View Source
var WebFS embed.FS
WebFS is the embedded filesystem containing the web folder.
Functions ¶
func ErrInvalidRequest ¶
func ErrUnauthorized ¶
func LoggingMiddleware ¶
Types ¶
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 HTTPWriter ¶
type HTTPWriter struct { Writer http.ResponseWriter CloseCh chan bool // contains filtered or unexported fields }
func NewHTTPResponseWriteCloser ¶
func NewHTTPResponseWriteCloser(w http.ResponseWriter) *HTTPWriter
func (*HTTPWriter) Close ¶
func (rwc *HTTPWriter) Close() error
func (*HTTPWriter) Flush ¶
func (rwc *HTTPWriter) Flush()
func (*HTTPWriter) GetObjects ¶
func (w *HTTPWriter) GetObjects() []*response_object_structs.ResponseObject
func (*HTTPWriter) Header ¶
func (rwc *HTTPWriter) Header() http.Header
func (*HTTPWriter) SetPreWriteCallback ¶
func (w *HTTPWriter) SetPreWriteCallback(fn func())
func (*HTTPWriter) WriteHeader ¶
func (rwc *HTTPWriter) WriteHeader(statusCode int)
func (*HTTPWriter) WriteObject ¶
func (rwc *HTTPWriter) WriteObject(obj *response_object_structs.ResponseObject) error
Click to show internal directories.
Click to hide internal directories.