boltimore

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: MIT Imports: 12 Imported by: 0

README

Boltimore

Super-lightweight framework for rapid development of RESTful APIs based on bolted.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Boltimore

type Boltimore struct {
	*mux.Router
	DB *bolted.Bolted

	Watcher *watcher.Watcher
	// contains filtered or unexported fields
}

func NewWithExistingDBAndWatcher added in v0.6.0

func NewWithExistingDBAndWatcher(db *bolted.Bolted, w *watcher.Watcher, options ...Option) (*Boltimore, error)

func Open

func Open(dir string, options ...Option) (*Boltimore, error)

func (*Boltimore) Close

func (b *Boltimore) Close() error

type ChangeWatcherContext added in v0.5.0

type ChangeWatcherContext struct {
	DB     *bolted.Bolted
	Logger *zap.SugaredLogger
}

type CronFunctionContext added in v0.5.0

type CronFunctionContext struct {
	DB     *bolted.Bolted
	Logger *zap.SugaredLogger
}

type InitFunctionContext added in v0.5.0

type InitFunctionContext struct {
	DB     *bolted.Bolted
	Logger *zap.SugaredLogger
}

type Option added in v0.1.0

type Option func(b *Boltimore) error

func ChangeWatcher added in v0.3.0

func ChangeWatcher(path string, fn func(cwc *ChangeWatcherContext)) Option

func CronFunction added in v0.1.0

func CronFunction(schedule string, fn func(cfc *CronFunctionContext)) Option

func Endpoint added in v0.5.0

func Endpoint(method, path string, fn func(rc *RequestContext) error) Option

func InitFunction added in v0.1.0

func InitFunction(fn func(ifc *InitFunctionContext) error) Option

func ZapLogger added in v0.5.0

func ZapLogger(l *zap.SugaredLogger) Option

type RequestContext added in v0.5.0

type RequestContext struct {
	Request        *http.Request
	ResponseWriter http.ResponseWriter
	DB             *bolted.Bolted

	Watcher *watcher.Watcher
	Logger  *zap.SugaredLogger
	// contains filtered or unexported fields
}

func (*RequestContext) ParseJSON added in v0.5.0

func (r *RequestContext) ParseJSON(v interface{}) error

func (*RequestContext) RespondWithError added in v0.5.1

func (r *RequestContext) RespondWithError(error string, statusCode int) error

func (*RequestContext) RespondWithJSON added in v0.5.0

func (r *RequestContext) RespondWithJSON(v interface{}) error

func (*RequestContext) RespondWithStatusCode added in v0.6.0

func (r *RequestContext) RespondWithStatusCode(statusCode int) error

func (*RequestContext) RespondWithStatusCodeAndJSON added in v0.5.1

func (r *RequestContext) RespondWithStatusCodeAndJSON(statusCode int, v interface{}) error

func (*RequestContext) RouteVariable added in v0.5.0

func (r *RequestContext) RouteVariable(name string) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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