Documentation
¶
Index ¶
- Constants
- Variables
- func NewLogger() *zerolog.Logger
- func NewMiddleware(logger *zerolog.Logger) []func(next http.Handler) http.Handler
- func NewMux(a *APIManager, middleware []func(next http.Handler) http.Handler) (http.Handler, error)
- func SetupAPIServer(lifecycle fx.Lifecycle, config Config, logger *zerolog.Logger, ...) error
- type APIManager
- type Config
- type DefaultRoutingTableManager
- type Error
- type InvalidOptionError
- type Response
- type RoutingTableEntry
- type RoutingTableManager
- type Status
- type Tracing
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 NewMiddleware ¶
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 ¶
func (r *DefaultRoutingTableManager) AddRoute(ctx context.Context, entry *RoutingTableEntry) error
type Error ¶
type Error struct {
Err error
// contains filtered or unexported fields
}
Error is a generic 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
Click to show internal directories.
Click to hide internal directories.