internal

package
v0.0.0-...-224a6a0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ASSETS_PATH  = "./assets"
	FILES_PATH   = ASSETS_PATH + "/files"
	IMAGES_PATH  = ASSETS_PATH + "/images"
	SCRIPTS_PATH = ASSETS_PATH + "/scripts"
	STYLES_PATH  = ASSETS_PATH + "/styles"

	MIGRATIONS_PATH = "./migrations"

	TEMPLATES_PATH = "./templates"
)

Variables

View Source
var (
	// ExcServerGeneric generic server exception.
	ExcServerGeneric = NewException(http.StatusInternalServerError, "ERR_SERVER_GENERIC")

	// ExcServerUnavailable server Unavailable exception.
	ExcServerUnavailable = NewException(http.StatusServiceUnavailable, "ERR_SERVER_UNAVAILABLE")

	// ExcRequestTimeout request timeout exception.
	ExcRequestTimeout = NewException(http.StatusRequestTimeout, "ERR_REQUEST_TIMEOUT")

	// ExcClientGeneric generic client exception.
	ExcClientGeneric = NewException(http.StatusBadRequest, "ERR_CLIENT_GENERIC")

	// ExcInvalidRequest invalid request exception.
	ExcInvalidRequest = NewException(http.StatusBadRequest, "ERR_INVALID_REQUEST")

	// ExcInvalidRequest not found exception.
	ExcNotFound = NewException(http.StatusNotFound, "ERR_NOT_FOUND")

	// ExcUnauthorized unauthorized exception.
	ExcUnauthorized = NewException(http.StatusUnauthorized, "ERR_UNAUTHORIZED")
)
View Source
var Environment = struct {
	PRODUCTION  string
	DEVELOPMENT string
	TESTING     string
}{"prod", "dev", "test"}

Functions

func NewError

func NewError(message string) func() *Error

Types

type Configuration

type Configuration struct {
	Environment string

	DatabaseHost     string
	DatabasePort     int
	DatabaseSSLMode  string
	DatabaseUser     string
	DatabasePassword string
	DatabaseName     string
	DatabaseMinConns int
	DatabaseMaxConns int

	CacheHost     string
	CachePort     int
	CachePassword string
	CacheMinConns int
	CacheMaxConns int

	AppHost    string
	AppPort    int
	AppRelease string
	AppOrigins []string
	AppName    string

	ServiceSMSEnabled   bool
	ServiceEmailEnabled bool
	ServicePushEnabled  bool

	TwilioBaseURL    string
	TwilioAccountSID string
	TwilioApiKey     string
	TwilioApiSecret  string
	TwilioFromPhone  string
	TwilioOriginator string
	TwilioRegion     string
	TwilioEdge       string

	SendGridApiKey    string
	SendGridFromName  string
	SendGridFromEmail string

	GracefulTimeout      int
	RequestHeaderMaxSize int
	RequestBodyMaxSize   int
	RequestFileMaxSize   int
	SessionKey           string
}

func NewConfiguration

func NewConfiguration(override *Configuration) *Configuration

type ContextKey

type ContextKey string

type Error

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

func (*Error) As

func (self *Error) As(err error) *Error

func (*Error) AsWithDepth

func (self *Error) AsWithDepth(depth int, err error) *Error

func (Error) Error

func (self Error) Error() string

func (Error) Is

func (self Error) Is(err error) bool

func (Error) Unwrap

func (self Error) Unwrap() error

func (*Error) With

func (self *Error) With(message string) *Error

func (*Error) Wrap

func (self *Error) Wrap(err error) *Error

func (*Error) WrapWithDepth

func (self *Error) WrapWithDepth(depth int, err error) *Error

type Exception

type Exception struct {
	Origin  error  `json:"-"`
	Status  int    `json:"-"`
	Code    string `json:"code"`
	Message string `json:"message,omitempty"`
}

func NewException

func NewException(status int, code string) *Exception

func (*Exception) Cause

func (self *Exception) Cause(err error) *Exception

func (Exception) Error

func (self Exception) Error() string

func (Exception) JSON

func (self Exception) JSON() string

func (*Exception) Redact

func (self *Exception) Redact()

func (Exception) String

func (self Exception) String() string

func (Exception) Unwrap

func (self Exception) Unwrap() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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