Documentation
¶
Index ¶
- Variables
- func Cwd() (cwd string, err error)
- func GetValue(key string) interface{}
- func GetValueWithDefault(key string, options ConfigEntityGetOptions) interface{}
- func IsFileExist(filePath string) bool
- func MapGet(m map[interface{}]interface{}, key string, defaultValue interface{}) interface{}
- func NewError(msg string, err error) error
- func StructToURLValues(m interface{}) url.Values
- type ApolloConfig
- type ApolloEntity
- type Application
- type Config
- type ConfigEntity
- type ConfigEntityGetOptions
- type Configurations
- type Data
- type HTTPOptions
- type HTTPService
- type Headers
- type Logger
- type LogrusLogger
- func (logger LogrusLogger) Debug(args interface{})
- func (logger LogrusLogger) Debugf(format string, v ...interface{})
- func (logger LogrusLogger) Error(args interface{})
- func (logger LogrusLogger) Errorf(format string, v ...interface{})
- func (logger LogrusLogger) Fatal(args interface{})
- func (logger LogrusLogger) Info(args interface{})
- func (logger LogrusLogger) Panic(args interface{})
- func (logger LogrusLogger) Trace(args interface{})
- func (logger LogrusLogger) Warn(args interface{})
- func (logger LogrusLogger) Warnf(format string, v ...interface{})
- type NacosClient
- type NacosConfig
- type NacosHTTPService
- type NacosHttpResult
- type Params
- type Result
- type Server
- type ServiceDiscovery
- type ServiceOptions
- type Static
- type TextFormatter
- type Winter
- func (winter *Winter) DELETE(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
- func (winter *Winter) GET(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
- func (winter *Winter) Group(relativePath string, handlers ...gin.HandlerFunc) *gin.RouterGroup
- func (winter *Winter) IsComing(addr ...string)
- func (winter *Winter) OPTIONS(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
- func (winter *Winter) POST(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
- func (winter *Winter) PUT(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
- func (winter *Winter) Use(middlewares ...gin.HandlerFunc)
Constants ¶
This section is empty.
Variables ¶
var (
// DefaultTimestampFormat default timestamp format
DefaultTimestampFormat = "2006-01-02 15:04:05"
)
var ( // Log log Log = DefaultLogger() )
Functions ¶
func GetValueWithDefault ¶
func GetValueWithDefault(key string, options ConfigEntityGetOptions) interface{}
GetValueWithDefault returns config value by config key
func IsFileExist ¶
IsFileExist judges target file exists or not
func MapGet ¶
func MapGet(m map[interface{}]interface{}, key string, defaultValue interface{}) interface{}
MapGet returns value by key with defaultValue
func StructToURLValues ¶
StructToURLValues converts struct to url.Values
Types ¶
type ApolloConfig ¶
type ApolloConfig struct { Meta string `json:"meta"` AppID string `json:"appId"` Cluster string `json:"cluster"` Namespaces []string `json:"namespaces"` }
ApolloConfig stores apollo configurations
type ApolloEntity ¶
type ApolloEntity struct {
// contains filtered or unexported fields
}
ApolloEntity provides an ability to get config value by config key from apollo
func (*ApolloEntity) Get ¶
func (apolloEntity *ApolloEntity) Get(key string) interface{}
Get returns config value by config key
type Application ¶
Application stores application configuration
type Config ¶
type Config struct { ENV string `json:"env"` App Application `json:"app"` Server Server `json:"server"` Static Static `json:"static"` ConfigFileConfigurations Configurations `json:"configurations"` // contains filtered or unexported fields }
Config stores default and custom configuration
ENV: "dev" or "prod"
func (*Config) GetValue ¶
func (config *Config) GetValue(configKey string, options ConfigEntityGetOptions) interface{}
GetValue returns config value by config key
type ConfigEntity ¶
type ConfigEntity interface {
Get(key string) interface{}
}
ConfigEntity provides an ability to get config value by config key
type ConfigEntityGetOptions ¶
type ConfigEntityGetOptions struct {
DefaultValue interface{}
}
ConfigEntityGetOptions stores get options
type Configurations ¶
type Configurations map[string]interface{}
Configurations stores all configurations
type HTTPOptions ¶
HTTPOptions option
type HTTPService ¶
type HTTPService interface { Get(path string, options HTTPOptions) (Result, error) Post(path string, options HTTPOptions) (Result, error) }
HTTPService provides an ability to call service
func Service ¶
func Service(serviceName string, options ServiceOptions) (httpService HTTPService, err error)
Service return httpService
type Logger ¶
type Logger interface { Trace(args interface{}) Debug(args interface{}) Info(args interface{}) Warn(args interface{}) Error(args interface{}) Fatal(args interface{}) Panic(args interface{}) resty.Logger }
Logger interface
type LogrusLogger ¶
type LogrusLogger struct {
// contains filtered or unexported fields
}
LogrusLogger logger
func DefaultLogger ¶
func DefaultLogger() *LogrusLogger
DefaultLogger returns a default logger TODO performance
func (LogrusLogger) Debugf ¶
func (logger LogrusLogger) Debugf(format string, v ...interface{})
Debugf debugf
func (LogrusLogger) Errorf ¶
func (logger LogrusLogger) Errorf(format string, v ...interface{})
Errorf errorf
func (LogrusLogger) Warnf ¶
func (logger LogrusLogger) Warnf(format string, v ...interface{})
Warnf warnf
type NacosClient ¶
type NacosClient struct {
// contains filtered or unexported fields
}
NacosClient provides an ability to
func NewNacosClientWithConfig ¶
func NewNacosClientWithConfig(config map[interface{}]interface{}) (nacosClient *NacosClient, err error)
NewNacosClientWithConfig returns nacos client via config
func (*NacosClient) GetHTTPService ¶
func (nacosClient *NacosClient) GetHTTPService(serviceName string, options ServiceOptions) (httpService HTTPService, err error)
GetHTTPService returns a http service to use service
func (*NacosClient) SetLogger ¶
func (nacosClient *NacosClient) SetLogger(l resty.Logger)
SetLogger sets nacos httpClient's logger
type NacosConfig ¶
type NacosConfig struct { Client constant.ClientConfig `mapstructure:",squash"` Server constant.ServerConfig `mapstructure:",squash"` }
NacosConfig nacos config
type NacosHTTPService ¶
type NacosHTTPService struct {
// contains filtered or unexported fields
}
NacosHTTPService nacosHTTPService
func (NacosHTTPService) Get ¶
func (httpService NacosHTTPService) Get(path string, options HTTPOptions) (result Result, err error)
Get provides an ability to get response via http GET method
func (NacosHTTPService) Post ¶
func (httpService NacosHTTPService) Post(path string, options HTTPOptions) (result Result, err error)
Post provides an ability to get response via http POST method
type NacosHttpResult ¶
type NacosHttpResult struct {
// contains filtered or unexported fields
}
func (NacosHttpResult) JSON ¶
func (httpResult NacosHttpResult) JSON(container interface{}) error
JSON returns response as JSONObject
func (NacosHttpResult) Raw ¶
func (httpResult NacosHttpResult) Raw() []byte
func (NacosHttpResult) String ¶
func (httpResult NacosHttpResult) String() string
String returns response as string
type ServiceDiscovery ¶
type ServiceDiscovery interface {
GetHTTPService(serviceName string, options ServiceOptions) (HTTPService, error)
}
ServiceDiscovery provides an ability to call service
type ServiceOptions ¶
type ServiceOptions map[string]interface{}
ServiceOptions stores service options
type TextFormatter ¶
TextFormatter text format
type Winter ¶
type Winter struct {
// contains filtered or unexported fields
}
Winter winter
func (*Winter) Group ¶
func (winter *Winter) Group(relativePath string, handlers ...gin.HandlerFunc) *gin.RouterGroup