pkg

package
v0.0.0-...-54934fd Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidParam = ErrorRegistry().
					AddErrorCode(4000).
					AddHttpStatus(http.StatusBadRequest).
					NewError("invalid parameter")
	ErrExists = ErrorRegistry().
				AddErrorCode(4001).
				AddHttpStatus(http.StatusConflict).
				NewError("resource already existed")
	ErrNotExists = ErrorRegistry().
					AddErrorCode(4002).
					AddHttpStatus(http.StatusNotFound).
					NewError("resource does not exist")
	ErrInvalidHttpMethod = ErrorRegistry().
							AddErrorCode(4003).
							AddHttpStatus(http.StatusMethodNotAllowed).
							WrapError("invalid http method", fiber.ErrMethodNotAllowed)

	ErrSystem = ErrorRegistry().
				AddErrorCode(5000).
				AddHttpStatus(http.StatusInternalServerError).
				NewError("system issue")
	ErrDatabase = ErrorRegistry().
				AddErrorCode(5001).
				AddHttpStatus(http.StatusInternalServerError).
				NewError("database issue")
)
View Source
var (
	ErrInvalidUsername = ErrorRegistry().
		AddErrorCode(6000).
		WrapError("username must be having a upper letter", ErrInvalidParam)
)

Functions

func ErrorRegistry

func ErrorRegistry() *utility.ErrorRegistry

func Init

func Init(conf *Config) io.Closer

Init initializes the necessary default global variables

func Logger

func Logger() *wlog.Logger

func Shutdown

func Shutdown() *utility.Shutdown

func Version

func Version() version

Types

type Config

type Config struct {
	NodeId_     string       `yaml:"NodeId"`
	Hack        utility.Hack `yaml:"Hack"`
	ShowErrCode bool         `yaml:"ShowErrCode"`

	Filepath Filepath `yaml:"Filepath"`
	Http     Http     `yaml:"Http"`
	MySql    MySql    `yaml:"MySql"`
	Redis    Redis    `yaml:"Redis"`

	O11Y   utility.O11YConfig `yaml:"O11Y"`
	Logger wlog.Config        `yaml:"Logger"`
}

func MustLoadConfig

func MustLoadConfig() *Config

func (*Config) NodeId

func (c *Config) NodeId() string

type Filepath

type Filepath struct {
	Logger string `yaml:"Logger"` // output to stderr if empty
	Event  string `yaml:"Event"`  // output to stdout if empty
}

type Http

type Http struct {
	Port  string `yaml:"Port"`
	Debug bool   `yaml:"Debug"`
}

type MySql

type MySql struct {
	User     string `yaml:"User"`
	Password string `yaml:"Password"`
	Host     string `yaml:"Host"`
	Port     string `yaml:"Port"`
	Database string `yaml:"Database"`
	Debug    bool   `yaml:"Debug"`
}

func (*MySql) DSN

func (conf *MySql) DSN() string

type Redis

type Redis struct {
	User     string `yaml:"User"`
	Password string `yaml:"Password"`
	Host     string `yaml:"Host"`
	Port     string `yaml:"Port"`
}

func (Redis) Address

func (conf Redis) Address() string

func (*Redis) SetHost

func (conf *Redis) SetHost(host string)

func (*Redis) SetPort

func (conf *Redis) SetPort(port string)

Directories

Path Synopsis
api
Package app is a generated GoMock package.
Package app is a generated GoMock package.
dataflow
ref1: https://github.com/KScaesar/art?tab=readme-ov-file#example
ref1: https://github.com/KScaesar/art?tab=readme-ov-file#example
wfiber
wfiber is a wrapped fiber
wfiber is a wrapped fiber
wgin
wgin is a wrapped gin
wgin is a wrapped gin
wlog
wlog is a wrapped logger
wlog is a wrapped logger

Jump to

Keyboard shortcuts

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