openapi

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package openapi implements OpenAPI server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIError

func APIError(code int32, msg string) *model.Error

APIError returns model.Error with given code and msg.

func ErrPayload

func ErrPayload(err error) interface{}

ErrPayload returns err.Payload or *model.Error(nil) or err for unknown errors.

func InitMetrics

func InitMetrics(reg *prometheus.Registry, namespace string)

InitMetrics must be called once before using this package. It registers and initializes metrics used by this package.

func NewServer

func NewServer(appl app.Appl, cfg Config) (*restapi.Server, error)

NewServer returns OpenAPI server configured to listen on the TCP network address cfg.Host:cfg.Port and handle requests on incoming connections.

Types

type Config

type Config struct {
	Seed                 int64
	DisableAccessLog     bool
	Addr                 netx.Addr
	BasePath             string
	Pprof                bool
	OpCashPercentFail    int
	OpCashRate           int
	OpDigRate            int
	OpDigTimeout         time.Duration
	OpExploreAreaRate    int
	OpExploreAreaTimeout time.Duration
	OpGetBalanceRate     int
	OpIssueLicenseRate   int
	OpListLicensesRate   int
}

Config contains configuration for OpenAPI server.

type Ctx

type Ctx = context.Context

Ctx is a synonym for convenience.

type Log

type Log = *structlog.Logger

Log is a synonym for convenience.

Jump to

Keyboard shortcuts

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