tux

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2022 License: MIT Imports: 9 Imported by: 0

README

tux

Handmade and minimalistic Go web framework

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTraceID added in v0.0.6

func GetTraceID(ctx context.Context) string

func IsShutdown added in v0.0.8

func IsShutdown(err error) bool

func NewShutdownError added in v0.0.8

func NewShutdownError(msg string) error

func Respond added in v0.0.5

func Respond(ctx context.Context, w http.ResponseWriter, data any, statusCode int) error

func SetStatusCode added in v0.0.6

func SetStatusCode(ctx context.Context, statusCode int) error

Types

type Circuit added in v0.0.5

type Circuit func(Route) Route

Circuit is a function designed to run some code before and/or after another handler.

type Route added in v0.0.4

The Route type is an adapter to allow the use of our advanced functions as HTTP handlers.

type Tux

type Tux struct {
	*bunrouter.CompatRouter
	// contains filtered or unexported fields
}

func New

func New(shutdown chan os.Signal, ct ...Circuit) *Tux

New creates a Tux value that handle a set of routes for the application.

func (*Tux) AddRoute added in v0.0.2

func (t *Tux) AddRoute(verb string, group string, path string, route Route, ct ...Circuit)

AddRoute registers the route (handler) function for the given pattern.

func (*Tux) Finish

func (t *Tux) Finish()

Finish is used to gracefully shutdown our race when an integrity issue is identified.

type Values added in v0.0.6

type Values struct {
	TraceID    string
	Now        time.Time
	StatusCode int
}

func GetValues added in v0.0.6

func GetValues(ctx context.Context) (*Values, error)

Jump to

Keyboard shortcuts

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