goflag

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 3 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 {
	http.Handler
	chi.Routes
}

type ControllerFlag

type ControllerFlag interface {
	Controller
	Info() *ControllerInformation
}

func FlagController

func FlagController(controller Controller, info ...ControllerInformation) ControllerFlag

type ControllerInformation

type ControllerInformation struct {
	Information
	Name string
}

func (*ControllerInformation) WithName

func (info *ControllerInformation) WithName(name string) *ControllerInformation

type EndpointFlag

type EndpointFlag interface {
	http.Handler
	Info() *EndpointInformation
}

EndpointFlag is just a http.Handler which can also provide EndpointInformation

func FlagEndpoint

func FlagEndpoint(endpoint http.Handler, info ...EndpointInformation) EndpointFlag

type EndpointInformation

type EndpointInformation struct {
	Information
	Input  *Type
	Output *Type
	Hidden bool
}

EndpointInformation contains the information that can be set for a handler. This is only readable since handler can be anything provided to gotrac. Once the handler is registered with a Router a Route is returned where the information can be edited.

func (*EndpointInformation) WithDescription

func (c *EndpointInformation) WithDescription(description string) *EndpointInformation

func (*EndpointInformation) WithHidden

func (c *EndpointInformation) WithHidden(hidden bool) *EndpointInformation

func (*EndpointInformation) WithInput

func (c *EndpointInformation) WithInput(typ *Type) *EndpointInformation

func (*EndpointInformation) WithOutput

func (c *EndpointInformation) WithOutput(typ *Type) *EndpointInformation

func (*EndpointInformation) WithSummary

func (c *EndpointInformation) WithSummary(summary string) *EndpointInformation

type Information

type Information struct {
	Summary     string
	Description string
}

Information contains the basic fields which can be set on most objects

func (*Information) WithDescription

func (c *Information) WithDescription(description string) *Information

func (*Information) WithSummary

func (c *Information) WithSummary(summary string) *Information

type InformationFlag

type InformationFlag interface {
	Info() *Information
}

type Type

type Type struct {
	GoType   reflect.Type
	HttpType []string
}

Type defines both the type used in go and the http content type (MIME-type)

Jump to

Keyboard shortcuts

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