common

package
v0.0.0-...-b9deefd Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func FirstError

func FirstError(errors ...error) error

func ReturnError

func ReturnError(ctx *context.Context, err error)

func ReturnErrorText

func ReturnErrorText(ctx *context.Context, errText string)

func ReturnErrorTextWithStatus

func ReturnErrorTextWithStatus(ctx *context.Context, status int, errText string)

func ReturnErrorWithStatus

func ReturnErrorWithStatus(ctx *context.Context, status int, err error)

func ReturnJSON

func ReturnJSON[T any](ctx *context.Context, f func() (T, error))

func SafeBasicAuthLoad

func SafeBasicAuthLoad(filename string, userOptions ...basicauth.UserAuthOption) (handler context.Handler, err error)

Types

type CachedAuth

type CachedAuth struct {
	// contains filtered or unexported fields
}

func NewCachedAuth

func NewCachedAuth(expirationDuration time.Duration) *CachedAuth

func (*CachedAuth) Option

func (a *CachedAuth) Option(options *basicauth.UserAuthOptions)

Jump to

Keyboard shortcuts

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