Documentation ¶
Index ¶
- func CheckPasswordHash(password, hash string) bool
- func HashPassword(password string) (string, error)
- func InitLogger(level LogLevel, logPath string, linkPath string) error
- func LoadConfig(yamlFilePath string, cfg *Config) error
- func Log(level LogLevel, msg string, ctx LogEvent)
- func LogError(level LogLevel, msg string, err error)
- func ParseConnectionURL(cfg *Config) (string, error)
- func ParseMigrationConnectionURL(cfg *Config) (string, error)
- func UpperCaseFirst(str string) string
- type AuthConfig
- type BusinessErr
- type CacheConfig
- type Config
- type DatabaseConfig
- type DatabaseSortType
- type ErrorBuilder
- type ErrorDetail
- type ErrorMessage
- func GetAuthError(message string, status int) *ErrorMessage
- func GetDatabaseError(err error) *ErrorMessage
- func GetErrorMessage(err error) *ErrorMessage
- func GetSystemError(err error) *ErrorMessage
- func GetValidationError(err error) *ErrorMessage
- func NewErrorMessage(errType ErrorTypeCode, detail string, status int) *ErrorMessage
- type ErrorTypeCode
- type LogEvent
- type LogLevel
- type SetupErr
- type SystemErr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPasswordHash ¶
func HashPassword ¶
func LoadConfig ¶
func ParseConnectionURL ¶
func UpperCaseFirst ¶
Capitalises the first character of a string
Types ¶
type AuthConfig ¶
type BusinessErr ¶
type BusinessErr error
type CacheConfig ¶
type Config ¶
type Config struct { Database DatabaseConfig `yaml:"database"` Cache CacheConfig `yaml:"cache"` Auth AuthConfig `yaml:"auth"` }
type DatabaseConfig ¶
type DatabaseConfig struct { Driver string `yaml:"driver"` Username string `yaml:"username" envconfig:"DATABASE_USERNAME"` Password string `yaml:"password" envconfig:"DATABASE_PASSWORD"` Host string `yaml:"host" envconfig:"DATABASE_HOST"` Port string `yaml:"port" envconfig:"DATABASE_PORT"` DbName string `yaml:"dbname" envconfig:"DATABASE_NAME"` SslMode string `yaml:"ssl-mode"` }
type DatabaseSortType ¶
type DatabaseSortType string
const ( Ascendent DatabaseSortType = "asc" Descendent DatabaseSortType = "desc" )
type ErrorBuilder ¶
type ErrorBuilder func(string, string) *ErrorDetail
type ErrorDetail ¶
type ErrorMessage ¶
type ErrorMessage struct { ErrorType string `json:"errorType"` Detail string `json:"detail"` Status int `json:"status"` Errors []*ErrorDetail `json:"errors,omitempty"` }
func GetAuthError ¶
func GetAuthError(message string, status int) *ErrorMessage
func GetDatabaseError ¶
func GetDatabaseError(err error) *ErrorMessage
func GetErrorMessage ¶
func GetErrorMessage(err error) *ErrorMessage
func GetSystemError ¶
func GetSystemError(err error) *ErrorMessage
func GetValidationError ¶
func GetValidationError(err error) *ErrorMessage
func NewErrorMessage ¶
func NewErrorMessage(errType ErrorTypeCode, detail string, status int) *ErrorMessage
func (*ErrorMessage) AddErrorDetail ¶
func (m *ErrorMessage) AddErrorDetail(err error, builder ErrorBuilder)
func (*ErrorMessage) Error ¶
func (m *ErrorMessage) Error() string
type ErrorTypeCode ¶
type ErrorTypeCode string
Click to show internal directories.
Click to hide internal directories.