internal

package
v0.0.0-...-6b0986e Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ApplicationErrorForbidden           = ApplicationError{HTTPStatusCode: 403, ErrorCode: "FORBIDDEN", ErrorText: "forbidden"}
	ApplicationErrorInvalidInput        = ApplicationError{HTTPStatusCode: 400, ErrorCode: "INVALID_INPUT", ErrorText: "invalid input"}
	ApplicationErrorInternalServerError = ApplicationError{HTTPStatusCode: 500, ErrorCode: "INTERNAL_SERVER_ERROR", ErrorText: "unknown error"}
)

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Version   string `yaml:"version"`
	Port      int    `yaml:"port"`
	Env       string `yaml:"env"`
	Debug     bool   `yaml:"debug"`
	LogToFile bool   `yaml:"logToFile"`
}

type AppContext

type AppContext struct {
	Wg *sync.WaitGroup
	context.Context
}

type ApplicationError

type ApplicationError struct {
	HTTPStatusCode int    `json:"statusCode,omitempty"`
	ErrorCode      string `json:"code,omitempty"`
	ErrorText      string `json:"message,omitempty"`
}

func ApplicationErrorFromJson

func ApplicationErrorFromJson(body []byte, status int) ApplicationError

func NewApplicationError

func NewApplicationError(httpStatusCode int, errorCode, errorText string) ApplicationError

func (ApplicationError) CustomMessage

func (err ApplicationError) CustomMessage(message string) ApplicationError

func (ApplicationError) Error

func (err ApplicationError) Error() string

type RequestContext

type RequestContext struct {
	Logger *zerolog.Logger
	context.Context
}

func NewRequestContext

func NewRequestContext(ctx context.Context) RequestContext

func (*RequestContext) WithLogger

func (r *RequestContext) WithLogger(logger zerolog.Logger)

Directories

Path Synopsis
infra
api

Jump to

Keyboard shortcuts

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