engine

package
v0.0.0-...-7d7277e Latest Latest
Warning

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

Go to latest
Published: May 1, 2018 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client struct

func (*Client) Device

func (v *Client) Device() router.Device

Device returns device information

func (*Client) Host

func (v *Client) Host() string

Host returns request hostname

func (*Client) IP

func (v *Client) IP() string

IP returns client ip address

func (*Client) Protocol

func (v *Client) Protocol() string

Protocol returns protocol name

type Context

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

func (*Context) Abort

func (v *Context) Abort()

func (*Context) Body

func (v *Context) Body(s string) (router.Value, error)

func (*Context) Cache

func (v *Context) Cache() router.CacheAdaptor

func (*Context) Child

func (v *Context) Child() router.Context

func (*Context) Client

func (v *Context) Client() router.Client

func (*Context) Context

func (v *Context) Context() context.Context

func (*Context) Cookie

func (v *Context) Cookie() router.Cookie

func (*Context) DataLoader

func (v *Context) DataLoader(o interface{}) router.DataLoaderAdaptor

func (*Context) Deadline

func (v *Context) Deadline() (time.Time, bool)

func (*Context) Done

func (v *Context) Done() <-chan struct{}

func (*Context) Err

func (v *Context) Err() error

func (*Context) Error

func (v *Context) Error(e error) router.Context

func (*Context) File

func (v *Context) File(s string) []byte

func (*Context) GQLSubscription

func (v *Context) GQLSubscription() router.GQLSubscriptionAdaptor

func (*Context) Header

func (v *Context) Header() router.Header

func (*Context) Identity

func (v *Context) Identity() router.Identity

func (*Context) IsAborted

func (v *Context) IsAborted() bool

func (*Context) Json

func (v *Context) Json(o interface{}) router.Context

func (*Context) KV

func (v *Context) KV() router.KV

func (*Context) MachineID

func (v *Context) MachineID() string

func (*Context) MatchParameter

func (v *Context) MatchParameter(s string, typ router.ParamType) router.Value

func (*Context) Message

func (v *Context) Message() router.MessageAdaptor

func (*Context) MustBody

func (v *Context) MustBody(s string) router.Value

func (*Context) MustParam

func (v *Context) MustParam(s string) router.Value

func (*Context) MustQuery

func (v *Context) MustQuery(s string) router.Value

func (*Context) Param

func (v *Context) Param(s string) (router.Value, error)

func (*Context) ProcessID

func (v *Context) ProcessID() string

func (*Context) Proto

func (*Context) Query

func (v *Context) Query(s string) (router.Value, error)

func (*Context) Recover

func (v *Context) Recover() error

func (*Context) Req

func (v *Context) Req() *http.Request

func (*Context) Res

func (v *Context) Res() http.ResponseWriter

func (*Context) StartSpan

func (v *Context) StartSpan(operationName string, opts ...opentracing.StartSpanOption) opentracing.Span

func (*Context) Status

func (v *Context) Status(code int) router.Context

func (*Context) Tracer

func (v *Context) Tracer() opentracing.Tracer

func (*Context) Value

func (v *Context) Value(key interface{}) interface{}

func (*Context) Write

func (v *Context) Write(b []byte) router.Context
type Cookie struct {
	// contains filtered or unexported fields
}

Cookie struct

func (*Cookie) Get

func (v *Cookie) Get(key string) (router.Value, error)

Get data from request cookie

func (*Cookie) MustGet

func (v *Cookie) MustGet(key string) router.Value

MustGet data from request cookie

func (*Cookie) Set

func (v *Cookie) Set(key string, val string, o ...cookie.Option)

Set data to response cookie

type Device

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

Device struct

func (*Device) Hardware

func (v *Device) Hardware() router.Hardware

Hardware to return client hardware information

func (*Device) OS

func (v *Device) OS() router.OS

OS returns operating system information

func (*Device) Useragent

func (v *Device) Useragent() router.Useragent

Useragent to return ua information

type Hardware

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

Hardware struct

func (*Hardware) Brand

func (v *Hardware) Brand() string

Brand returns hardware brand name

func (*Hardware) Family

func (v *Hardware) Family() string

Family returns hardware family name

func (*Hardware) Model

func (v *Hardware) Model() string

Model returns hardware model name

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

Header struct

func (*Header) Get

func (v *Header) Get(key string) (router.Value, error)

Get data from request header

func (*Header) MustGet

func (v *Header) MustGet(key string) router.Value

MustGet data from request header

func (*Header) Set

func (v *Header) Set(key string, val string)

Set data to response header

type OS

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

OS struct

func (*OS) Family

func (v *OS) Family() string

Family returns operating system family name

func (*OS) Major

func (v *OS) Major() string

Major returns operating system major version

func (*OS) Minor

func (v *OS) Minor() string

Minor returns operating system minor version

func (*OS) Patch

func (v *OS) Patch() string

Patch returns operating system patch version

type Option

type Option func(*Options)

Option func

func Addr

func Addr(s string) Option

Addr to change server bind address

func AllowCredentials

func AllowCredentials(b bool) Option

func AllowOriginFunc

func AllowOriginFunc(f func(string) bool) Option

func AllowedHeaders

func AllowedHeaders(a []string) Option

func AllowedMethods

func AllowedMethods(a []string) Option

func AllowedOrigins

func AllowedOrigins(a []string) Option

func Cache

func Cache(c cache.Service) Option

Cache to bind cache interface to engine server

func DataLoader

func DataLoader(d dataloader.Service) Option

DataLoader server

func ExposedHeaders

func ExposedHeaders(a []string) Option

func GQLSubscription

func GQLSubscription(s gws.Service) Option

GQLSubscription to bind graphql subscription interface to engine server

func ID

func ID(s string) Option

ID to change server reference id

func MaxAge

func MaxAge(i int) Option

func Message

func Message(m message.Service) Option

Message broker

func OptionsPassthrough

func OptionsPassthrough(b bool) Option

func Proto

func Proto(p Protocol) Option

Proto to change http network protocol

func Router

func Router(r router.Service) Option

Router to bind router to engine server

func Websocket

func Websocket(w websocket.Service) Option

Websocket to bind websocket server

type Options

type Options struct {

	// engine server unique id
	ID string

	// server bind to address [host:port]
	Addr string

	// HTTP protocol 1.1 / 2.0
	Protocol Protocol

	// Cache
	Cache cache.Service

	// Message broker
	Message message.Service

	// GraphQL subscription server
	GQLSubscription gws.Service

	// DataLoader
	DataLoader dataloader.Service

	// Router
	Router router.Service

	// Websocket service
	Websocket websocket.Service

	// AllowedOrigins is a list of origins a cross-domain request can be executed from.
	// If the special "*" value is present in the list, all origins will be allowed.
	// An origin may contain a wildcard (*) to replace 0 or more characters
	// (i.e.: http://*.domain.com). Usage of wildcards implies a small performance penality.
	// Only one wildcard can be used per origin.
	// Default value is ["*"]
	AllowedOrigins []string

	// AllowOriginFunc is a custom function to validate the origin. It take the origin
	// as argument and returns true if allowed or false otherwise. If this option is
	// set, the content of AllowedOrigins is ignored.
	AllowOriginFunc func(origin string) bool

	// AllowedMethods is a list of methods the client is allowed to use with
	// cross-domain requests. Default value is simple methods (GET and POST)
	AllowedMethods []string

	// AllowedHeaders is list of non simple headers the client is allowed to use with
	// cross-domain requests.
	// If the special "*" value is present in the list, all headers will be allowed.
	// Default value is [] but "Origin" is always appended to the list.
	AllowedHeaders []string

	// ExposedHeaders indicates which headers are safe to expose to the API of a CORS
	// API specification
	ExposedHeaders []string

	// AllowCredentials indicates whether the request can include user credentials like
	// cookies, HTTP authentication or client side SSL certificates.
	AllowCredentials bool

	// MaxAge indicates how long (in seconds) the results of a preflight request
	// can be cached
	MaxAge int

	// OptionsPassthrough instructs preflight to let other potential next handlers to
	// process the OPTIONS method. Turn this on if your application handles OPTIONS.
	OptionsPassthrough bool
}

Options is the engine server options

type Protocol

type Protocol float32

Protocol type

const (
	HTTP  Protocol = 1.1
	HTTP2          = 2
)

Protocols

type Service

type Service interface {
	Start() error
	Stop() error
	String() string
}

Service interface

func New

func New(opts ...Option) Service

New creates engine server

type Useragent

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

Useragent struct

func (*Useragent) Family

func (v *Useragent) Family() string

Family returns useragent family name

func (*Useragent) Major

func (v *Useragent) Major() string

Major returns useragent major version

func (*Useragent) Minor

func (v *Useragent) Minor() string

Minor returns useragent minor version

func (*Useragent) Patch

func (v *Useragent) Patch() string

Patch returns useragent patch version

func (*Useragent) String

func (v *Useragent) String() string

String returns useragent string

type Value

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

Value struct

func (*Value) Has

func (v *Value) Has() bool

Has represents if input exists

func (*Value) Key

func (v *Value) Key() string

Key of value

func (*Value) MustBool

func (v *Value) MustBool() bool

MustBool returns data in boolean format

func (*Value) MustF32

func (v *Value) MustF32() float32

MustF32 returns data in float32 format

func (*Value) MustF64

func (v *Value) MustF64() float64

MustF64 returns data in float64 format

func (*Value) MustI32

func (v *Value) MustI32() int32

MustI32 returns data in int32 format

func (*Value) MustI64

func (v *Value) MustI64() int64

MustI64 returns data in int64 format

func (*Value) MustInt

func (v *Value) MustInt() int

MustInt returns the data in int format

func (*Value) MustTime

func (v *Value) MustTime() time.Time

MustTime returns data in time.Time format

func (*Value) MustU32

func (v *Value) MustU32() uint32

MustU32 returns data in uint32 format

func (*Value) MustU64

func (v *Value) MustU64() uint64

MustU64 returns data in uint64 format

func (*Value) String

func (v *Value) String() string

func (*Value) ThrowIllegal

func (v *Value) ThrowIllegal(cause fault.Cause)

ThrowIllegal throws illegal type error

func (*Value) Type

func (v *Value) Type() router.ParamType

Type of value

func (*Value) Val

func (v *Value) Val() []byte

Val is the data of value

Jump to

Keyboard shortcuts

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