datacenter

package
v0.0.0-...-83adff0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

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

type ConditionMapType map[string]map[string]interface{}

ConditionMapType condition map

type ConditionType

type ConditionType map[string]interface{}

ConditionType condition's in map

func ConditionGt

func ConditionGt(v interface{}) ConditionType

ConditionGt >

func ConditionGte

func ConditionGte(v interface{}) ConditionType

ConditionGte >=

func ConditionIn

func ConditionIn(v ...interface{}) ConditionType

ConditionIn in

func ConditionLt

func ConditionLt(v interface{}) ConditionType

ConditionLt <

func ConditionLte

func ConditionLte(v interface{}) ConditionType

ConditionLte <=

type HttpClient

type HttpClient struct {
	Debug bool
	// contains filtered or unexported fields
}

HttpClient http client

func New

func New(c *ClientConfig) *HttpClient

New new 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) Error

func (q *Query) Error() error

Error return error if get error

func (*Query) Limit

func (q *Query) Limit(limit, offset int) *Query

Limit limit, same as sql

func (*Query) Order

func (q *Query) Order(sort string) *Query

Order order field, use similar as sql

func (*Query) Select

func (q *Query) Select(fields string) *Query

Select select fields, use similar as sql

func (*Query) String

func (q *Query) String() (res string)

String to string

func (*Query) Where

func (q *Query) Where(conditions ...ConditionMapType) *Query

Where where condition, see test for examples

type Response

type Response struct {
	Code   int         `json:"code"`
	Msg    string      `json:"msg"`
	Result interface{} `json:"result"`
}

Response response

type SortType

type SortType map[string]int

SortType sort

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL