app

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogTraceId      = "tx.traceId"
	LogSpanId       = "tx.spanId"
	LogParentSpanId = "tx.parentSpanId"
	LogChildSpanId  = "tx.childSpanId"
	LogTenantId     = "gears.app.id"
)

Logging expected keys

View Source
const (
	HeaderTraceId      = "X-B3-TraceId"
	HeaderSpanId       = "X-B3-SpanId"
	HeaderParentSpanId = "X-B3-ParentSpanId"
	HeaderTenantId     = "Application-Id"
)

API header expected keys

Variables

View Source
var Version = "v0.0.0"

Functions

func NewLogger

func NewLogger() *zerolog.Logger

func NewMiddleware

func NewMiddleware(logger *zerolog.Logger) []func(next http.Handler) http.Handler

func NewMux

func NewMux(a *APIManager, middleware []func(next http.Handler) http.Handler) (http.Handler, error)

func SetupAPIServer

func SetupAPIServer(lifecycle fx.Lifecycle, config Config, logger *zerolog.Logger, mux http.Handler) error

Types

type APIManager

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

func NewAPIManager

func NewAPIManager(routingMgr RoutingTableManager) (*APIManager, error)

type Config

type Config interface {
	GetString(key string) string
	GetInt(key string) int
	GetBool(key string) bool
}

Config interface for uber/fx

type DefaultRoutingTableManager

type DefaultRoutingTableManager struct {
}

func (*DefaultRoutingTableManager) AddRoute

type Error

type Error struct {
	Err error
	// contains filtered or unexported fields
}

Error is a generic error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Is

func (e *Error) Is(target error) bool

func (*Error) Unwrap

func (e *Error) Unwrap() error

type InvalidOptionError

type InvalidOptionError struct {
	Err error
	// contains filtered or unexported fields
}

InvalidOptionError is returned when an invalid option is passed in

func (*InvalidOptionError) Error

func (e *InvalidOptionError) Error() string

func (*InvalidOptionError) Is

func (e *InvalidOptionError) Is(target error) bool

func (*InvalidOptionError) Unwrap

func (e *InvalidOptionError) Unwrap() error

type Response

type Response struct {
	Status  *Status  `json:"status,omitempty" xml:"status,omitempty"`
	Tracing *Tracing `json:"tx,omitempty" xml:"tx,omitempty"`

	Item  interface{} `json:"item,omitempty" xml:"item,omitempty"`
	Items interface{} `json:"items,omitempty" xml:"items,omitempty"`
	Data  interface{} `json:"data,omitempty" xml:"data,omitempty"`
}

func (Response) Respond

func (r Response) Respond(w http.ResponseWriter)

type RoutingTableEntry

type RoutingTableEntry struct {
}

A RoutingEntry represents an entry in the EARS routing table

type RoutingTableManager

type RoutingTableManager interface {
	AddRoute(ctx context.Context, entry *RoutingTableEntry) error // idempotent operation to add a routing entry to a local routing table 		// get hash for local version of routing table
}

A RoutingTableManager supports modifying and querying an EARS routing table

func NewRoutingTableManager

func NewRoutingTableManager() RoutingTableManager

type Status

type Status struct {
	Code    int    `json:"code,omitempty" xml:"code,omitempty"`
	Message string `json:"message,omitempty" xml:"message,omitempty"`
}

type Tracing

type Tracing struct {
	TraceId string `json:"traceId,omitempty" xml:"traceId,omitempty"`
	SpanId  string `json:"spanId,omitempty" xml:"spanId,omitempty"`
}

Jump to

Keyboard shortcuts

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