Documentation ¶
Index ¶
- Constants
- Variables
- func AbortRequest(c *gin.Context, resp *Response)
- func AccessLogHandler() gin.HandlerFunc
- func BodySign(key, body string) (string, error)
- func CheckEnv(env string) error
- func ConfigError(config string) error
- func ConfigNotFound(config string) error
- func ErrMsg(errCode int) string
- func GetBool(key string) bool
- func GetConfig(key string) interface{}
- func GetDuration(key string) time.Duration
- func GetEnv() string
- func GetFloat64(key string) float64
- func GetInt(key string) int
- func GetInt32(key string) int32
- func GetInt64(key string) int64
- func GetOceanApp() string
- func GetOceanMode() string
- func GetOceanNamespace() string
- func GetOceanPodIp() string
- func GetOceanPodName() string
- func GetOceanVersion() string
- func GetRequestBody(ctx context.Context) string
- func GetRequestURI(ctx context.Context) string
- func GetString(key string) string
- func GetStringMap(key string) map[string]interface{}
- func GetStringMapString(key string) map[string]string
- func GetStringMapStringSlice(key string) map[string][]string
- func GetStringSlice(key string) []string
- func GetTime(key string) time.Time
- func GetUint(key string) uint
- func GetUint32(key string) uint32
- func GetUint64(key string) uint64
- func JsonResponse(c *gin.Context, code int, message, result interface{})
- func LogAddCustomHeader(header string)
- func LogCritical(ctx context.Context, a interface{})
- func LogDebug(ctx context.Context, a interface{})
- func LogError(ctx context.Context, a interface{})
- func LogInfo(ctx context.Context, a interface{})
- func LogWarn(ctx context.Context, a interface{})
- func New() error
- func NewConfig() error
- func NewHttp() error
- func RenderJson(c *gin.Context, resp *Response)
- func Run() error
- func RunHttp() error
- func SetErrMsg(errCode int, message string) error
- type BwHttpEngine
- type BwMysqlCluster
- type HttpClient
- func (client *HttpClient) Get(ctx context.Context, url string, query map[string]string, ...) (string, error)
- func (client *HttpClient) MultiplePost(ctx context.Context, url string, params map[string]string, ...) (map[int]string, map[int]error)
- func (client *HttpClient) OriginPost(ctx context.Context, url string, query map[string]string, ...) (string, error)
- func (client *HttpClient) Post(ctx context.Context, url string, query map[string]string, ...) (string, error)
- func (client *HttpClient) TFormGet(ctx context.Context, addr string, query map[string]string, ...) (string, error)
- func (client *HttpClient) TFormPost(ctx context.Context, addr string, query map[string]string, ...) (string, error)
- type Model
- func (m *Model) Count(cond map[string]interface{}) (count int64, err error)
- func (m *Model) Find(record interface{}, cond ...interface{}) error
- func (m *Model) FindAndCount(record interface{}, cond ...interface{}) (int64, error)
- func (m *Model) Get(cond map[string]interface{}, result interface{}) (err error)
- func (m *Model) Insert(data interface{}) (int64, error)
- func (m *Model) InsertMulti(rowsSlicePtr interface{}) (int64, error)
- func (m *Model) InsertOne(data interface{}) (int64, error)
- func (m *Model) Update(cond, fields map[string]interface{}) (int64, error)
- type MysqlClient
- type MysqlStatus
- type Response
Constants ¶
View Source
const ( DeployEnvDev = "Development" DeployEnvTest = "Test" DeployEnvProd = "Production" NamespaceDev = "dev" NamespaceTest = "test" )
View Source
const ( Success = 0 ErrUnknown = 99999 // 未知错误 ErrInternal = 99998 // 内部错误 ErrMysql = 99997 // Mysql错误 ErrRedis = 99996 // Redis错误 ErrParam = 10001 // 参数错误 )
Variables ¶
View Source
var ( // Http HttpEngine *BwHttpEngine // Mysql MysqlEngine *MysqlClient // Redis RedisEngine *redis.BwRedisClient // MysqlCluster MysqlCluster BwMysqlCluster )
Functions ¶
func ConfigError ¶
func ConfigNotFound ¶
func GetDuration ¶
func GetFloat64 ¶
func GetOceanApp ¶
func GetOceanApp() string
func GetOceanNamespace ¶
func GetOceanNamespace() string
func GetOceanPodIp ¶
func GetOceanPodIp() string
func GetOceanPodName ¶
func GetOceanPodName() string
func GetOceanVersion ¶
func GetOceanVersion() string
func GetStringMap ¶
func GetStringMapString ¶
func GetStringMapStringSlice ¶
func GetStringSlice ¶
func JsonResponse ¶
func LogCritical ¶
func RenderJson ¶
Types ¶
type BwHttpEngine ¶
type BwMysqlCluster ¶
func NewMysqlCluster ¶
func NewMysqlCluster(configs []*mysqlClusterConfig) (BwMysqlCluster, error)
简易版mysql集群多实例 TODO 某实例宕机后如何让上层业务感知,摘除该实例 TODO 某实例宕机一段时间后又恢复了如何让上层业务感知,启用该实例
type HttpClient ¶
type HttpClient struct {
*middleware.HttpClient
}
func NewHttpClient ¶
func NewHttpClient(t time.Duration) *HttpClient
func (*HttpClient) MultiplePost ¶
func (client *HttpClient) MultiplePost(ctx context.Context, url string, params map[string]string, headers map[string]string, bodyList map[int]interface{}) (map[int]string, map[int]error)
Content-Type 是 application/json;charset=utf-8
func (*HttpClient) OriginPost ¶
func (client *HttpClient) OriginPost(ctx context.Context, url string, query map[string]string, headers map[string]string, body string) (string, error)
Content-Type 自定义
func (*HttpClient) Post ¶
func (client *HttpClient) Post(ctx context.Context, url string, query map[string]string, headers map[string]string, body interface{}) (string, error)
Content-Type 是 application/json;charset=utf-8
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
func (*Model) FindAndCount ¶
func (*Model) InsertMulti ¶
type MysqlClient ¶
func NewMysql ¶
func NewMysql(config *mysqlConfig) (*MysqlClient, error)
func (*MysqlClient) Status ¶
func (e *MysqlClient) Status() *MysqlStatus
type MysqlStatus ¶
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
func NewCodeResponse ¶
func NewResponse ¶
func (*Response) GetErrCode ¶
func (*Response) GetMessage ¶
func (r *Response) GetMessage() interface{}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.