Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// App is the basic bootstrap information
App GeneralInfo
// Information about HTTP Server
HTTPServer HTTPServerInfo
// Database information
DB DBInfo
}
Context holds information from bootstrap to be used
func (*Context) InitServer ¶
InitServer starts a new HTTP server or return an error
type DBInfo ¶
type DBInfo struct {
// Port number to be used
Port uint
// How many connections to use for connection pool
MaxConnections uint
// Host address
Host string
// Database name
DBName string
// Username to be connect with
Username string
// The password for the given username
Password string
// Configuration of the pool
Config *pgxpool.Config
// Pointer to the pool connection
Pool *pgxpool.Pool
}
type GeneralInfo ¶
GeneralInfo of the application
type HTTPError ¶
type HTTPError struct {
// HTTP Status Code
StatusCode int `example:"400" json:"status_code" validate:"required,min=400,max=599"`
// Reason for the error
Message string `example:"Something went wrong" json:"message" validate:"required"`
// Additional information to provide (if existd)
Info map[string]any `json:"info,omitempty" validate:"omitempty,omitnil"`
}
HTTPError holds information regarding HTTP request
type HTTPServerInfo ¶
type HTTPServerInfo struct {
// Raw port
Port uint
// Raw host
Host string
// How documentation will look (raw)
ExternalHost string
// Raw listen based on both Host and Port
Listen string
// web application
App *echo.Echo
}
HTTPServerInfo holds information about the HTTP server
type User ¶
type User struct {
// User's first name
FirstName string `json:"first_name" validate:"required,alphaunicode,max=15,min=2"`
// User's middle name (if exists)
MiddleName string `json:"middle_name,omitempty" validate:"min=0,max=15,omitempty,omitnil"`
// User's last name
LastName string `json:"last_name" validate:"required,alphaunicode,max=20,min=2"`
// User's username that is in use
Username string `json:"username" validate:"required,alphanumunicode|containsrune=.-_0x20100x20110x2015,max=24,min=2"`
}
Click to show internal directories.
Click to hide internal directories.