yoda

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: MIT Imports: 6 Imported by: 2

README

yoda

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer added in v0.2.0

func NewServer(config Config) *yoda

Creates a new standard yoda server

func NewServerWithConfig added in v0.2.0

func NewServerWithConfig(config atreugo.Config) *yoda

Creates a yoda server with config

Types

type Config added in v0.2.0

type Config struct {
	Addr         string
	Name         string
	CORS         cors.Config
	IdleTimeout  time.Duration
	WriteTimeout time.Duration
	ReadTimeout  time.Duration
}

Config

type Context added in v0.2.0

type Context struct {
	Parent *atreugo.RequestCtx
}

Context struct

func (*Context) Bind added in v0.2.0

func (c *Context) Bind(i interface{}) error

Binds a json into a struct

func (*Context) Created added in v0.2.0

func (c *Context) Created(obj interface{}) error

Creates a JSON response with status created

func (*Context) Error added in v0.2.0

func (c *Context) Error(err vader.Error) error

Creates a JSON response with an error

func (*Context) FromContext added in v0.2.0

func (c *Context) FromContext(key string) interface{}

Returns a value from a context using the key

func (*Context) GetHeader added in v0.2.0

func (c *Context) GetHeader(key string) []byte

func (*Context) JSON added in v0.2.0

func (c *Context) JSON(status int, obj interface{}) error

Creates a JSON response

func (*Context) NewResponse added in v0.2.0

func (c *Context) NewResponse(status int, message string) error

Creates a default response with a message

func (*Context) Next added in v0.2.0

func (c *Context) Next() error

Next function

func (*Context) OK added in v0.2.0

func (c *Context) OK(obj interface{}) error

Creates a JSON response with status OK

type Handler added in v0.2.0

type Handler func(*Context) error

Handler

type Response

type Response struct {
	Message string `json:"message,omitempty"`
	Error   string `json:"error,omitempty"`
}

Response struct

type Router added in v0.2.0

type Router struct {
	Parent *atreugo.Router
}

Router struct

func (*Router) Delete added in v0.2.0

func (r *Router) Delete(path string, handler Handler)

func (*Router) Get added in v0.2.0

func (r *Router) Get(path string, handler Handler)

func (*Router) Patch added in v0.2.0

func (r *Router) Patch(path string, handler Handler)

func (*Router) Post added in v0.2.0

func (r *Router) Post(path string, handler Handler)

func (*Router) Put added in v0.2.0

func (r *Router) Put(path string, handler Handler)

func (*Router) Use added in v0.2.0

func (r *Router) Use(middlewares ...Handler)

Append middlewares to router

type Yoda

type Yoda interface {
	Run()
}

Server interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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