stdlib

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCache

func NewCache() cache.Cache

NewCache will create a new instance of the built-in cache

func NewLogger

func NewLogger() logger.Logger

newBuiltinLogger will create a new instance of the mojito builtin logger implementation

Types

type Cache added in v0.0.3

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

func (*Cache) Contains added in v0.0.3

func (m *Cache) Contains(key string) (bool, error)

Contains returns whether a key is present in the cache

func (*Cache) Delete added in v0.0.3

func (m *Cache) Delete(key string) error

Delete removes a cache entry by its key, will do nothing if the key was not present in the cache It will also cancel any existing expirations for the given key

func (*Cache) ExpireAfter added in v0.0.3

func (m *Cache) ExpireAfter(key string, duration time.Duration) error

ExpireAfter will mark a cache key for expiration after a certain duration

func (*Cache) Get added in v0.0.3

func (m *Cache) Get(key string, out interface{}) error

Get will attempt to read a stored cache value into the given out interface pointer or error if not present

func (*Cache) GetOrDefault added in v0.0.3

func (m *Cache) GetOrDefault(key string, out interface{}, def interface{}) error

Get will attempt to read a stored cache value into the given out interface pointer or return default if not found

func (*Cache) Set added in v0.0.3

func (m *Cache) Set(key string, val interface{}) error

Set will attempt to store a value in the cache with a given key It will also reset any expirations set for the given key

type Logger added in v0.0.3

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

func (*Logger) Debug added in v0.0.3

func (z *Logger) Debug(msg interface{})

Debug will write a debug log

func (*Logger) Debugf added in v0.0.3

func (z *Logger) Debugf(msg string, values ...interface{})

Debugf will write a debug log sprintf-style

func (*Logger) Error added in v0.0.3

func (z *Logger) Error(msg interface{})

Error will write a error log

func (*Logger) Errorf added in v0.0.3

func (z *Logger) Errorf(msg string, values ...interface{})

Errorf will write a error log sprintf-style

func (*Logger) Fatal added in v0.0.3

func (z *Logger) Fatal(msg interface{})

Fatal will write a fatal log

func (*Logger) Fatalf added in v0.0.3

func (z *Logger) Fatalf(msg string, values ...interface{})

Fatalf will write a fatal log sprintf-style

func (*Logger) Field added in v0.0.3

func (z *Logger) Field(name string, val interface{}) logger.Logger

Field will add a field to a new logger and return it

func (*Logger) Fields added in v0.0.3

func (z *Logger) Fields(fields logger.Fields) logger.Logger

Fields will add multiple fields to a new logger and return it

func (*Logger) Info added in v0.0.3

func (z *Logger) Info(msg interface{})

Info will write a info log

func (*Logger) Infof added in v0.0.3

func (z *Logger) Infof(msg string, values ...interface{})

Infof will write a info log sprintf-style

func (*Logger) Trace added in v0.0.3

func (z *Logger) Trace(msg interface{})

Trace will write a trace log

func (*Logger) Tracef added in v0.0.3

func (z *Logger) Tracef(msg string, values ...interface{})

Tracef will write a trace log sprintf-style

func (*Logger) Warn added in v0.0.3

func (z *Logger) Warn(msg interface{})

Warn will write a warn log

func (*Logger) Warnf added in v0.0.3

func (z *Logger) Warnf(msg string, values ...interface{})

Warnf will write a warn log sprintf-style

type Renderer added in v0.0.3

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

func NewRenderer

func NewRenderer() *Renderer

func (Renderer) Render added in v0.0.3

func (b Renderer) Render(view string, bag renderer.ViewBag) (string, error)

Render will load a template file and render the template within using the viewbag as a context

func (Renderer) SetTemplateDir added in v0.0.3

func (b Renderer) SetTemplateDir(path string) error

SetTemplateDir will set the base directory where views are located

func (Renderer) TemplateDir added in v0.0.3

func (b Renderer) TemplateDir() string

TemplateDir will return the absolute path of the configured templates directory

type Router added in v0.0.3

type Router struct {
	Middleware []interface{}
	Routes     []router.Handler
	Router     *httprouter.Router
	Server     *http.Server
}

func NewRouter added in v0.0.3

func NewRouter() *Router

NewRouter will create new instance of the mojito stdlib router implementation

func (*Router) CONNECT added in v0.0.3

func (r *Router) CONNECT(path string, handler interface{}) error

CONNECT will add a route to this router for the connect method

func (*Router) DELETE added in v0.0.3

func (r *Router) DELETE(path string, handler interface{}) error

DELETE will add a route to this router for the delete method

func (*Router) GET added in v0.0.3

func (r *Router) GET(path string, handler interface{}) error

GET will add a route to this router for the get method

func (*Router) HEAD added in v0.0.3

func (r *Router) HEAD(path string, handler interface{}) error

HEAD will add a route to this router for the head method

func (*Router) ListenAndServe added in v0.0.3

func (r *Router) ListenAndServe(address string) error

ListenAndServe will start an HTTP webserver on the given address

func (*Router) OPTIONS added in v0.0.3

func (r *Router) OPTIONS(path string, handler interface{}) error

OPTIONS will add a route to this router for the options method

func (*Router) PATCH added in v0.0.3

func (r *Router) PATCH(path string, handler interface{}) error

PATCH will add a route to this router for the patch method

func (*Router) POST added in v0.0.3

func (r *Router) POST(path string, handler interface{}) error

POST will add a route to this router for the post method

func (*Router) PUT added in v0.0.3

func (r *Router) PUT(path string, handler interface{}) error

PUT will add a route to this router for the put method

func (*Router) Shutdown added in v0.0.3

func (r *Router) Shutdown() error

Shutdown will gracefully shutdown the router

func (*Router) TRACE added in v0.0.3

func (r *Router) TRACE(path string, handler interface{}) error

TRACE will add a route to this router for the trace method

func (*Router) WithErrorHandler added in v0.0.3

func (r *Router) WithErrorHandler(handler interface{}) error

WithErrorHandler will set the error handler for the router

func (*Router) WithGroup added in v0.0.3

func (r *Router) WithGroup(path string, callback func(group router.Group)) error

WithGroup will create a new route group for the given prefix

func (*Router) WithMiddleware added in v0.0.3

func (r *Router) WithMiddleware(handler interface{}) error

WithMiddleware will add a middleware to the router

func (*Router) WithNotAllowed added in v0.0.3

func (r *Router) WithNotAllowed(handler interface{}) error

WithNotAllowed will set the not allowed handler for the router

func (*Router) WithNotFound added in v0.0.3

func (r *Router) WithNotFound(handler interface{}) error

WithNotFound will set the not found handler for the router

func (*Router) WithRoute added in v0.0.3

func (r *Router) WithRoute(method string, path string, handler interface{}) error

WithRoute will add a new route with the given RouteMethod to the router

Jump to

Keyboard shortcuts

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