utils

package
v0.0.0-...-6778a4b Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError interface {
	Error() string
	GetStatus() int
	SetStatus(int)
	GetMessage() string
	SetMessage(string)
}

APIError interface

type ApplicationError

type ApplicationError struct {
	StatusCode int
	Err        error
	Message    string
}

ApplicationError application error struct

func NewApplicationError

func NewApplicationError(err error) *ApplicationError

NewApplicationError generates a new ApplicationError

func (*ApplicationError) Error

func (r *ApplicationError) Error() string

func (*ApplicationError) GetMessage

func (r *ApplicationError) GetMessage() string

GetMessage details of the error

func (*ApplicationError) GetStatus

func (r *ApplicationError) GetStatus() int

GetStatus status code for the error

func (*ApplicationError) SetMessage

func (r *ApplicationError) SetMessage(message string)

SetMessage sets the details map of the error

func (*ApplicationError) SetStatus

func (r *ApplicationError) SetStatus(status int)

SetStatus sets the status code for the error

type Config

type Config struct {
	DB struct {
		Type string `yaml:"type"`
	} `yaml:"DB"`
	SQLite3 struct {
		Path   string `yaml:"path"`
		DBName string `yaml:"db_name"`
	} `yaml:"SQLITE3"`
	PostgreSQL struct {
		Host   string `yaml:"host"`
		Port   string `yaml:"port"`
		DBName string `yaml:"db_name"`
	} `yaml:"POSTGRESQL"`
	Nitrado struct {
		Accounts map[string][]string `yaml:"accounts"`
	} `yaml:"NITRADO"`
}

Config struct that contians the structure of the config

func GetConfig

func GetConfig(env string) *Config

GetConfig gets the config file and returns a Config struct

type Log

type Log struct {
	MinSeverity    int
	LogInformation int
	LogLow         int
	LogMedium      int
	LogHigh        int
	LogFatal       int
}

Log struct

func InitLog

func InitLog(minSeverity int) *Log

InitLog initializes the log with a minimum severity level

func (*Log) Log

func (l *Log) Log(message interface{}, severity int)

Log outputs the log

type ModelError

type ModelError struct {
	StatusCode int
	Err        error
	Message    string
}

ModelError model error struct

func NewModelError

func NewModelError(err error) *ModelError

NewModelError generates a new ModelError

func (*ModelError) Error

func (r *ModelError) Error() string

func (*ModelError) GetMessage

func (r *ModelError) GetMessage() string

GetMessage details of the error

func (*ModelError) GetStatus

func (r *ModelError) GetStatus() int

GetStatus status code for the error

func (*ModelError) SetMessage

func (r *ModelError) SetMessage(message string)

SetMessage sets the details map of the error

func (*ModelError) SetStatus

func (r *ModelError) SetStatus(status int)

SetStatus sets the status code for the error

type RequestError

type RequestError struct {
	StatusCode int
	Err        error
	Message    string
}

RequestError request error struct

func NewRequestError

func NewRequestError(err error) *RequestError

NewRequestError generates a new RequestError

func (*RequestError) Error

func (r *RequestError) Error() string

func (*RequestError) GetMessage

func (r *RequestError) GetMessage() string

GetMessage details of the error

func (*RequestError) GetStatus

func (r *RequestError) GetStatus() int

GetStatus status code for the error

func (*RequestError) SetMessage

func (r *RequestError) SetMessage(message string)

SetMessage sets the details map of the error

func (*RequestError) SetStatus

func (r *RequestError) SetStatus(status int)

SetStatus sets the status code for the error

type ValidationError

type ValidationError struct {
	StatusCode int
	Err        error
	Message    string
}

ValidationError validation error struct

func NewValidationError

func NewValidationError(err error) *ValidationError

NewValidationError generates a new ValidationError

func (*ValidationError) Error

func (r *ValidationError) Error() string

func (*ValidationError) GetMessage

func (r *ValidationError) GetMessage() string

GetMessage details of the error

func (*ValidationError) GetStatus

func (r *ValidationError) GetStatus() int

GetStatus status code for the error

func (*ValidationError) SetMessage

func (r *ValidationError) SetMessage(message string)

SetMessage sets the details map of the error

func (*ValidationError) SetStatus

func (r *ValidationError) SetStatus(status int)

SetStatus sets the status code for the error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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