Documentation ¶
Index ¶
- Constants
- Variables
- func ClientIP(c *gin.Context) string
- func CreateToken(appId string, openid int64) (tokenStr string, err error)
- func FlagInit()
- func GrpcContext(c *gin.Context) context.Context
- func Handler(controller iController) gin.HandlerFunc
- func Init(env Environment)
- func LoadJsonConfig(jsonFile string, conf interface{}) (err error)
- func LoadYamlConfig(yamlFile string, conf interface{}) (err error)
- func RequestBody(c *gin.Context) interface{}
- func RequestId(c *gin.Context) string
- func ValidationMessage(err error, messages map[string]string) string
- type Config
- type Encryption
- type Environment
- type LocalUpload
- type Option
- func CorsHeaderOption(corsHeaders ...string) Option
- func EnableEncryptionOption(encryptKey, encryptSecret string, excludeUris ...string) Option
- func EnvOption(env Environment) Option
- func NoAccessPathsOption(noAccessPaths ...string) Option
- func NoLogPathsOption(noLogPaths ...string) Option
- func PProfEnableOption(pprofEnable bool) Option
- func ServerNameOption(serverName string) Option
- type Response
- type Server
- type Token
Constants ¶
View Source
const ERROR_DATABASE int64 = 555
View Source
const ERROR_FORBIDDEN int64 = 403
View Source
const ERROR_INVALID int64 = -1
View Source
const ERROR_NOTFOUND int64 = 404
View Source
const ERROR_PARAMS int64 = 700
View Source
const ERROR_REDIS int64 = 556
View Source
const ERROR_REQUEST int64 = 400
client
View Source
const ERROR_SERVER int64 = 500
server
View Source
const ERROR_UNAUTHORIZED int64 = 401
View Source
const SUCCESS_REQUEST = 0
Variables ¶
View Source
var ( Version string VersionFlag = flag.Bool("v", false, "version") HelpFlag = flag.Bool("h", false, "help") )
View Source
var ( UnknownStatus = 0 StatusValid = 1 StatusInValid = 2 )
Functions ¶
func CreateToken ¶ added in v1.0.17
func Init ¶ added in v1.0.14
func Init(env Environment)
func LoadJsonConfig ¶ added in v1.2.34
func LoadYamlConfig ¶ added in v1.2.34
Types ¶
type Config ¶ added in v1.2.52
type Config struct { Env Environment `yaml:"env"` Server struct { Addr string `yaml:"addr"` Name string `yaml:"name"` } `yaml:"server"` Prometheus prometheusx.Config `yaml:"prometheus"` MongoDB gomongo.Config `yaml:"mongodb"` Mysql gogorm.Config `yaml:"mysql"` Postgres gogorm.Config `yaml:"postgres"` Sqlite gogorm.Config `yaml:"sqlite"` Clickhouse1 gogorm.Config `yaml:"clickhouse1"` Redis goredis.Config `yaml:"redis"` Kafka gokafka.Config `yaml:"kafka"` Clickhouse goclickhouse.Config `yaml:"clickhouse"` Es goes.Config `yaml:"es"` Etcd goetcd.Config `yaml:"etcd"` FeiShu string `yaml:"feishu"` }
type Encryption ¶ added in v1.2.24
type Environment ¶ added in v1.0.15
type Environment string
const ( PRODUCTION Environment = "pro" PRE Environment = "pre" RT Environment = "rt" TEST Environment = "test" DEVELOPMENT Environment = "dev" )
库运行模式 dev|test|rt|pre|pro go-zero
var Env Environment //string `json:",default=pro,options=dev|test|rt|pre|pro"`
当前运行环境
func (Environment) String ¶ added in v1.0.15
func (env Environment) String() string
func (Environment) Tag ¶ added in v1.0.15
func (env Environment) Tag() string
type LocalUpload ¶ added in v1.2.24
type LocalUpload struct { }
type Option ¶ added in v1.2.24
type Option interface {
// contains filtered or unexported methods
}
func EnableEncryptionOption ¶ added in v1.2.24
启用加密传输
func NoAccessPathsOption ¶ added in v1.2.24
禁止访问的path
func NoLogPathsOption ¶ added in v1.2.24
不记录日志的path
type Response ¶
type Response struct { Code int32 `json:"code"` Message string `json:"message"` Data interface{} `json:"data"` Errors []interface{} `json:"-"` }
func ErrorWithValidate ¶ added in v1.2.24
Source Files ¶
Click to show internal directories.
Click to hide internal directories.