apis

package
v0.0.0-...-785f2ad Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyExists = errors.New("already exists")
View Source
var ErrBadRequest = errors.New("bad request")
View Source
var ErrMethodNotAllowed = errors.New("method not allowed")
View Source
var ErrNotFound = errors.New("not found")

Functions

func GetPathTokens

func GetPathTokens(r *http.Request) []string

Types

type API

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

func NewAPI

func NewAPI(logger *zap.Logger, txp dbutils.TxProvider, handler http.Handler) *API

func (*API) Close

func (api *API) Close() error

func (*API) DefaultHandler

func (api *API) DefaultHandler(w http.ResponseWriter, r *http.Request)

func (*API) Handle

func (api *API) Handle(w http.ResponseWriter, r *http.Request)

func (*API) Logger

func (api *API) Logger() *zap.Logger

func (*API) OptionsResponse

func (api *API) OptionsResponse(allowedMethods []string, w http.ResponseWriter, r *http.Request)

func (*API) Respond

func (api *API) Respond(w http.ResponseWriter, r *http.Request, respObj any, err error)

func (*API) Transaction

func (api *API) Transaction(ctx context.Context, fn func(tx *dbr.Tx) error) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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