Documentation
¶
Index ¶
- Constants
- Variables
- func Error(c *gin.Context, err *errno.Error)
- func ErrorParamInvalid(c *gin.Context, err error)
- func HealthCheck(c *gin.Context)
- func InitBasicDB(driver, dsn string) *gorm.DB
- func InitDB() *gorm.DB
- func InitRedis() *redis.Client
- func IsDev() bool
- func IsLocal() bool
- func IsProd() bool
- func IsTest() bool
- func NewReverseProxy(targetHost string) (*httputil.ReverseProxy, error)
- func ProxyGinHandler(targetHost string) gin.HandlerFunc
- func ProxyRequestHandler(targetHost string) func(http.ResponseWriter, *http.Request)
- func RootDir() (rootPath string)
- func RouteNotFound(c *gin.Context)
- func SetDefaultConf(v *viper.Viper)
- func Success(c *gin.Context, data any)
- func SuccessNil(c *gin.Context)
- type App
- type Config
- type DBConfig
- type EthConfig
- type Option
- type RedisConfig
- type Response
- type ServerConfig
- type SmsConfig
Constants ¶
View Source
const ( // EnvLocal 本地环境 EnvLocal = "local" // EnvDev 开发环境 EnvDev = "dev" // EnvTest 测试环境 EnvTest = "test" // EnvProd 生产环境 EnvProd = "prod" )
Variables ¶
View Source
var (
Conf = &Config{}
)
View Source
var DB *gorm.DB
DB 数据库全局变量
View Source
var Redis *redis.Client
Functions ¶
func HealthCheck ¶
HealthCheck will return OK if the underlying BoltDB is healthy. At least healthy enough for demoing purposes.
func NewReverseProxy ¶
func NewReverseProxy(targetHost string) (*httputil.ReverseProxy, error)
NewReverseProxy takes target host and creates a reverse proxy
func ProxyGinHandler ¶
func ProxyGinHandler(targetHost string) gin.HandlerFunc
ProxyGinHandler handles the http request using proxy
func ProxyRequestHandler ¶
func ProxyRequestHandler(targetHost string) func(http.ResponseWriter, *http.Request)
ProxyRequestHandler handles the http request using proxy
func SetDefaultConf ¶
Types ¶
type Config ¶
type Config struct { Env string Name string DfsUrl string Mode string LogLevel string LogDir string JwtSecret string JwtTimeout int64 Debug bool Proxy bool // 是否开启代理 http://[host]/ws -> ws://[host] HTTP ServerConfig Websocket ServerConfig Sms SmsConfig Eth EthConfig }
type RedisConfig ¶
type ServerConfig ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.