Documentation ¶
Index ¶
- Variables
- func Error(err error)
- func SentryInit(dsn, environment string)
- func StartServer(address string, handler http.Handler)
- func StartTLSServer(address string, handler http.Handler, certFile, keyFile string)
- type Context
- func (ctx *Context) BadRequest()
- func (ctx *Context) Close()
- func (ctx *Context) HubBreadcrumb(category, msg string, data map[string]interface{})
- func (ctx *Context) HubError(err error)
- func (ctx *Context) HubMessage(msg string)
- func (ctx *Context) InternalServerError(err error)
- func (ctx *Context) MethodNotAllowed()
- func (ctx *Context) NoContent()
- func (ctx *Context) NotFound()
- func (ctx *Context) Ok()
- func (ctx *Context) SendError(error error, status int)
- func (ctx *Context) SendSuccess(body interface{})
- func (ctx *Context) SetTag(key, value string)
- func (ctx *Context) Unauthorized()
- func (ctx *Context) UnprocessableEntity()
- type Event
- type HandlerFunc
- type MongoConn
- type MysqlConn
- type Routes
- type StandardLogger
Constants ¶
This section is empty.
Variables ¶
View Source
var SentryEnabled = false
Functions ¶
func SentryInit ¶ added in v1.2.2
func SentryInit(dsn, environment string)
func StartServer ¶
StartServer starts a simple http server
Types ¶
type Context ¶
type Context struct { context.Context Response http.ResponseWriter Request *http.Request Params url.Values Data *sync.Map SpanRoot *sentry.Span RouteInfo struct { VersionName string ResourceName string ResourceID string SubresourceName string SubresourceID string Method string CustomMethod string } Logger *StandardLogger // contains filtered or unexported fields }
func NewContext ¶
func NewContext(res http.ResponseWriter, req *http.Request) *Context
func (*Context) BadRequest ¶
func (ctx *Context) BadRequest()
func (*Context) HubBreadcrumb ¶
func (*Context) HubMessage ¶
func (*Context) InternalServerError ¶
func (*Context) MethodNotAllowed ¶
func (ctx *Context) MethodNotAllowed()
func (*Context) SendSuccess ¶
func (ctx *Context) SendSuccess(body interface{})
func (*Context) Unauthorized ¶
func (ctx *Context) Unauthorized()
func (*Context) UnprocessableEntity ¶
func (ctx *Context) UnprocessableEntity()
type Event ¶ added in v1.3.0
type Event struct {
// contains filtered or unexported fields
}
Event stores messages to log later, from our standard interface
type HandlerFunc ¶
type HandlerFunc func(*Context)
func (HandlerFunc) ServeHTTP ¶
func (f HandlerFunc) ServeHTTP(context *Context)
type MongoConn ¶
func CreateMongoConnection ¶
CreateMongoConnection Creates a DB Connection with the Database specified on the url
func (*MongoConn) CloseConnection ¶
CloseConnection Closes a DB Connection
type MysqlConn ¶
func CreateMysqlConnection ¶
func (*MysqlConn) CloseConnection ¶
CloseConnection Closes a DB Connection
type Routes ¶
type Routes struct {
Map map[string]version
}
var Router *Routes
func (*Routes) AddResource ¶
func (r *Routes) AddResource(name string, versionName string, handler HandlerFunc)
func (*Routes) AddSubresource ¶
func (r *Routes) AddSubresource(name string, version string, resourceName string, handler HandlerFunc)
func (*Routes) AddVersion ¶
type StandardLogger ¶ added in v1.3.0
StandardLogger enforces specific log message formats
func NewLogger ¶ added in v1.3.0
func NewLogger() *StandardLogger
NewLogger initializes the standard logger
func (*StandardLogger) Debug ¶ added in v1.3.0
func (l *StandardLogger) Debug(info string)
Debug is a standard error message
func (*StandardLogger) Info ¶ added in v1.3.0
func (l *StandardLogger) Info(info string)
Info is a standard error message
func (*StandardLogger) InvalidArg ¶ added in v1.3.0
func (l *StandardLogger) InvalidArg(argumentName string)
InvalidArg is a standard error message
func (*StandardLogger) InvalidArgValue ¶ added in v1.3.0
func (l *StandardLogger) InvalidArgValue(argumentName string, argumentValue string)
InvalidArgValue is a standard error message
func (*StandardLogger) MissingArg ¶ added in v1.3.0
func (l *StandardLogger) MissingArg(argumentName string)
MissingArg is a standard error message
Click to show internal directories.
Click to hide internal directories.