Documentation ¶
Index ¶
- Constants
- type ClientConfig
- type ConditionMapType
- type ConditionType
- type HttpClient
- func (client *HttpClient) Do(c context.Context, req *http.Request, res interface{}, v ...string) (err error)
- func (client *HttpClient) Get(c context.Context, uri string, params url.Values, res interface{}) (err error)
- func (client *HttpClient) NewRequest(method, uri string, params url.Values) (req *http.Request, err error)
- func (client *HttpClient) Raw(c context.Context, req *http.Request, v ...string) (bs []byte, err error)
- func (client *HttpClient) SetTransport(t http.RoundTripper)
- type Query
- type Response
- type SortType
Constants ¶
View Source
const ( IsNull = 1 IsNotNull = -1 )
value for Null operator
View Source
const ( Desc = -1 Asc = 1 )
value for sort
View Source
const (
//TimeStampFormat time format in second
TimeStampFormat = "2006-01-02 15:04:05"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientConfig ¶
type ClientConfig struct { Key string Secret string Dial time.Duration Timeout time.Duration KeepAlive time.Duration }
ClientConfig client config
type ConditionMapType ¶
ConditionMapType condition map
type HttpClient ¶
type HttpClient struct { Debug bool // contains filtered or unexported fields }
HttpClient http client
func (*HttpClient) Do ¶
func (client *HttpClient) Do(c context.Context, req *http.Request, res interface{}, v ...string) (err error)
Do sends an HTTP request and returns an HTTP json response.
func (*HttpClient) Get ¶
func (client *HttpClient) Get(c context.Context, uri string, params url.Values, res interface{}) (err error)
Get issues a GET to the specified URL.
func (*HttpClient) NewRequest ¶
func (client *HttpClient) NewRequest(method, uri string, params url.Values) (req *http.Request, err error)
NewRequest new http request with method, uri, ip, values and headers. TODO(zhoujiahui): param realIP should be removed later.
func (*HttpClient) Raw ¶
func (client *HttpClient) Raw(c context.Context, req *http.Request, v ...string) (bs []byte, err error)
Raw get from url
func (*HttpClient) SetTransport ¶
func (client *HttpClient) SetTransport(t http.RoundTripper)
SetTransport set client transport
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query query
func (*Query) Where ¶
func (q *Query) Where(conditions ...ConditionMapType) *Query
Where where condition, see test for examples
Click to show internal directories.
Click to hide internal directories.