Help us shape the future of Go! Take the 2026 Go Developer Survey

controller

package
v1.133.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	GetRoutes() Routes
}

Controller Pattern of an rest/stream controller

type DefaultController

type DefaultController struct {
}

DefaultController Default implementation

func (*DefaultController) ByteArrayResponse

func (c *DefaultController) ByteArrayResponse(w http.ResponseWriter, r *http.Request, contentType string, result []byte)

ByteArrayResponse Used for response data. I.e. image

func (*DefaultController) ErrorResponse

func (c *DefaultController) ErrorResponse(w http.ResponseWriter, r *http.Request, err error)

ErrorResponse Marshals error for user requester

func (*DefaultController) JSONResponse

func (c *DefaultController) JSONResponse(w http.ResponseWriter, r *http.Request, result any)

JSONResponse Marshals response with header

func (*DefaultController) JSONResponseWithCode

func (c *DefaultController) JSONResponseWithCode(w http.ResponseWriter, r *http.Request, code int, body any)

JSONResponse Marshals response with header and code

func (*DefaultController) ReaderEventStreamResponse

func (c *DefaultController) ReaderEventStreamResponse(w http.ResponseWriter, r *http.Request, reader io.Reader)

ReaderEventStreamResponse writes the content from the reader to the response, one line at a time as an event stream. Will stop at the end of stream, or when the client disconnects. Every 15 seconds a healthcheck event is sent to keep the connection alive.

func (*DefaultController) ReaderFileResponse

func (c *DefaultController) ReaderFileResponse(w http.ResponseWriter, r *http.Request, reader io.Reader, fileName, contentType string)

ReaderFileResponse writes the content from the reader to the response, and sets Content-Disposition=attachment; filename=<filename arg>

func (*DefaultController) ReaderResponse

func (c *DefaultController) ReaderResponse(w http.ResponseWriter, r *http.Request, reader io.Reader, contentType string)

ReaderResponse writes the content from the reader to the response,

type KubeApiConfig

type KubeApiConfig struct {
	QPS   float32
	Burst int
}

KubeApiConfig configuration for K8s API REST client

type RadixHandlerFunc

type RadixHandlerFunc func(accounts.Accounts, http.ResponseWriter, *http.Request)

RadixHandlerFunc Pattern for handler functions

type Route

type Route struct {
	Path                      string
	Method                    string
	HandlerFunc               RadixHandlerFunc
	AllowUnauthenticatedUsers bool
	KubeApiConfig             KubeApiConfig
}

Route Describe route

type Routes

type Routes []Route

Routes Holder of all routes

Jump to

Keyboard shortcuts

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