Documentation ¶
Index ¶
- Constants
- Variables
- func App(serviceName string, serviceUsage string, httpServer HttpServer, ...) (app *cli.App, err error)
- func CloseDB()
- func GetDBIndex(taskId int) (index string)
- func InitDB(DbUri string)
- func InitKey(c *gin.Context)
- func InitLogger() *logrus.Logger
- func InitRedisPool(network string, host string, password string, database int) (pool *redis.Pool)
- func LocalIP() string
- func NewHttpAuthError() error
- func NewMySqlCreateError() error
- func RedisGet(ctx *gin.Context, redisConn redis.Conn, key string) (value string, err error)
- func RedisGetCommon(redisConn redis.Conn, key string) (value string, err error)
- func RedisSet(ctx *gin.Context, redisConn redis.Conn, key string, value interface{}) (code int, err error)
- func RedisSetCommon(redisConn redis.Conn, key string, value interface{}) (code int, err error)
- type AuthGlobal
- type AuthModel
- type AuthRedis
- type BaseModel
- type BaseModelCreate
- type BaseModelName
- type BaseModelNormal
- type BaseService
- type GinResponse
- type HttpAuthError
- type HttpServer
- type HttpServerImpl
- type MysqlCreateError
- type PageBaseRequest
- type PageFormBaseRequest
- type Response
- type ServiceConfig
- type ServiceConfigImpl
Constants ¶
View Source
const ( HTTP_MISS_PARAMS = 101 HTTP_PARAMS_ERROR = 102 HTTP_STATUS_OK = 200 HTTP_AUTH_ERROR = 403 HTTP_INTERNAL_ERROR = 503 REDIS_SET_ERROR = 1001 REDIS_GET_ERROR = 1002 MYSQL_QUERY_ERROR = 2001 MYSQL_CREATE_ERROR = 2002 MYSQL_UPDATE_ERROR = 2003 HTTP_RESPONSE_OK = 0 )
View Source
const ( HTTP_AUTH_ERROR_MSG = "Auth Error" HTTP_MESSAGE_OK = "success" MYSQL_CREATE_ERROR_MSG = "Mysql Create Error" )
Variables ¶
View Source
var DB *gorm.DB
View Source
var LogrusLogger *logrus.Logger
View Source
var (
RedisPool *redis.Pool
)
Functions ¶
func App ¶
func App(serviceName string, serviceUsage string, httpServer HttpServer, serviceConfig ServiceConfig) (app *cli.App, err error)
func GetDBIndex ¶
func InitLogger ¶
func InitRedisPool ¶
func NewHttpAuthError ¶
func NewHttpAuthError() error
func NewMySqlCreateError ¶
func NewMySqlCreateError() error
func RedisGetCommon ¶
Types ¶
type AuthGlobal ¶
type AuthGlobal struct {
UserId int `json:"user_id"`
}
type AuthModel ¶
type BaseModelCreate ¶
type BaseModelName ¶
type BaseModelNormal ¶
type BaseModelNormal struct {
ID int `gorm:"primary_key" json:"id"`
}
type BaseService ¶
type GinResponse ¶
func (*GinResponse) Response ¶
func (gr *GinResponse) Response(code int, msg string, data interface{})
type HttpAuthError ¶
func (HttpAuthError) Error ¶
func (hae HttpAuthError) Error() string
type HttpServer ¶
type HttpServer interface { Serve(mode string) ServeWorker(mode string) Shutdown() Init(config ServiceConfig, configPath string) HttpServer }
type HttpServerImpl ¶
type MysqlCreateError ¶
func (MysqlCreateError) Error ¶
func (mce MysqlCreateError) Error() string
type PageBaseRequest ¶
type PageFormBaseRequest ¶
type ServiceConfig ¶
type ServiceConfig interface {
ConfigFromFileName(config string) ServiceConfig
}
type ServiceConfigImpl ¶
type ServiceConfigImpl struct { ServiceName string LogFile string JaegerAddr string ConsulAddr string ConsulPort int HttpAddr string DbUri string Port int RedisHost string RedisPort string RedisPassword string RedisDB int MqUri string }
func (ServiceConfigImpl) ConfigFromFileName ¶
func (serviceConfig ServiceConfigImpl) ConfigFromFileName(config string) ServiceConfig
Source Files ¶
Click to show internal directories.
Click to hide internal directories.