Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppResponse ¶
type AppResponse struct { Code int `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data"` }
func NewDataResponse ¶
func NewDataResponse(data interface{}) AppResponse
func NewErrorCodeResponse ¶
func NewErrorCodeResponse(err *errcode.Error) AppResponse
func NewErrorResponse ¶
func NewErrorResponse(code int, err error) AppResponse
func NewOkResponse ¶
func NewOkResponse() AppResponse
func TryErrorCodeResponse ¶
func TryErrorCodeResponse(err error) AppResponse
type DatabaseConfig ¶
type DatabaseConfig struct { Host string `scfg:"host"` Port int `scfg:"port"` Username string `scfg:"username"` Password string `scfg:"password"` Database string `scfg:"database,default=scene"` Options string `scfg:"options"` // in format of "key1=value1&key2=value2" }
DatabaseConfig is a struct that contains the configuration for a database. Universal database configuration. "scfg" is the tag name used in infrastructure/config.
func DatabaseConfigFromDSN ¶
func DatabaseConfigFromDSN(dsn string) DatabaseConfig
DatabaseConfigFromDSN parses a DSN string and returns a DatabaseConfig.
func (DatabaseConfig) MongoDSN ¶
func (d DatabaseConfig) MongoDSN() string
func (DatabaseConfig) MysqlDSN ¶
func (d DatabaseConfig) MysqlDSN() string
func (DatabaseConfig) RedisDSN ¶
func (d DatabaseConfig) RedisDSN() string
type FileConfig ¶
type FileConfig struct {
Path string
}
func NewFileConfig ¶
func NewFileConfig(path string) FileConfig
type PageResult ¶
type PaginationParam ¶
type PaginationParam struct { Offset int `json:"offset" bson:"offset"` // Page is the page number, starts from 0 Limit int `json:"limit" bson:"limit"` // Size is the page size }
PaginationParam is a *interface* struct provide interface for all common pagination parameter
type PaginationResult ¶
type PaginationResult[T any] struct { Total int64 `json:"total" bson:"total"` Offset int64 `json:"offset" bson:"offset"` Results []T `json:"results" bson:"results"` Count int64 `json:"count" bson:"count"` }
PaginationResult is a *interface* struct provide interface for all common pagination response
Click to show internal directories.
Click to hide internal directories.