infra

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CurrentLogOptions = &LogOptions{
	logLevelInt: seelog.DebugLvl,
	LogLevel:    seelog.DebugStr,
}

CurrentLogOptions current seelog options

Functions

func BootstrapLogger

func BootstrapLogger(opts *LogOptions)

BootstrapLogger loads seelog package into the overall system

func ConfigureLogger

func ConfigureLogger()

ConfigureLogger configures options using parsed flag values

func RegisterLoggerFlags

func RegisterLoggerFlags()

RegisterLoggerFlags registers logger CLI flags

Types

type Error

type Error struct {
	Message string `json:"message"`
}

Error represents a single error in an ErrorResponse

type ErrorResponse

type ErrorResponse struct {
	Errors []Error `json:"errors"`
}

ErrorResponse represent HTTP error payload swagger:model

func Multiple

func Multiple(errors []error) *ErrorResponse

Multiple creates an error response containing multiple errors

func Single

func Single(err error) *ErrorResponse

Single creates an error response containing a single error

type LogOptions

type LogOptions struct {
	LogLevel string
	// contains filtered or unexported fields
}

LogOptions seelog options

type Ping

type Ping struct {
	// example: pong
	Message string `json:"message"`
}

Ping represents ping response swagger:model

type PingEndpoint

type PingEndpoint struct {
}

PingEndpoint responds to ping

func NewPingEndpoint

func NewPingEndpoint() *PingEndpoint

NewPingEndpoint creates ping endpoint

func (*PingEndpoint) Ping

func (p *PingEndpoint) Ping(c *gin.Context)

Ping responds to ping swagger:operation GET /ping ping --- summary: Responds to ping responses:

'200':
  description: Ping successful
  schema:
    "$ref": "#/definitions/Ping"

func (*PingEndpoint) RegisterRoutes

func (p *PingEndpoint) RegisterRoutes(r gin.IRoutes)

RegisterRoutes registers ping route

type RateLimiter

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

RateLimiter limits requests to certain endpoints

func NewRateLimiter

func NewRateLimiter(requestsPerSecond float64) *RateLimiter

NewRateLimiter creates a new RateLimiter

func (*RateLimiter) Handler

func (r *RateLimiter) Handler() gin.HandlerFunc

Handler returns handler func for gin

type RequiredFieldError

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

RequiredFieldError represents a missing required field in HTTP request

func Required

func Required(field string) RequiredFieldError

Required creates a new RequiredFieldError

func (RequiredFieldError) Error

func (f RequiredFieldError) Error() string

Error returns user friendly message for RequiredFieldError

Jump to

Keyboard shortcuts

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