Documentation ¶
Index ¶
- Constants
- func Close()
- func CloseDB()
- func HTTPRequest[T any](req *http.Request, respBody *T) error
- func InitDB(dsn string) *sqlx.DB
- func InitRedis(addr, pwd string, idx int) *redis.Client
- func Logger() routtp.Handler
- func RawHTTPRequest(req *http.Request) (*http.Response, error)
- func Recovery() routtp.Handler
- func Start(srv *http.Server)
- func Transaction(dbx *sqlx.DB, fc func(*sqlx.Tx) error) error
- type Client
- func (client *Client) Invoke(meth string, url string, bReq any, sh ...func(*http.Header)) *Req
- func (client *Client) WithErrDecode(f func(*http.Response) error)
- func (client *Client) WithHeader(key string, value *string) *Client
- func (client *Client) WithRedirct(f func(*http.Request, []*http.Request) error) *Client
- func (client *Client) WithReqEncode(f func(any) (io.Reader, string, error))
- func (client *Client) WithRespDecode(f func(*http.Response, any) error)
- func (client *Client) WithTimeout(d time.Duration) *Client
- func (client *Client) WithTransport(trans http.RoundTripper) *Client
- type EgoSQL
- type Req
- type SQLInsert
- type SQLSelect
Constants ¶
View Source
const ( HeaderQiuUser = "X-Qiu-User" HeaderQiuPrior = "X-Qiu-Prior" HeaderQiuCity = "X-Qiu-City" HeaderQiuIp = "X-Qiu-Ip" HeaderQiuHost = "X-Qiu-Host" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) WithRedirct ¶
func (*Client) WithReqEncode ¶
func (*Client) WithRespDecode ¶
func (*Client) WithTransport ¶
func (client *Client) WithTransport(trans http.RoundTripper) *Client
type SQLInsert ¶
type SQLInsert interface { Fields(eg EgoSQL) SQLInsert Values(vs ...EgoSQL) SQLInsert Insert(dbxExec) error Clear() String() string }
func InsertInto ¶
type SQLSelect ¶
type SQLSelect interface { From(string) SQLSelect Join(string) SQLSelect On(string) SQLSelect Where(map[string]any) SQLSelect Limit(int) SQLSelect Offset(int) SQLSelect Group(string) SQLSelect Having(string) SQLSelect Order(string) SQLSelect Get(dbxGetSelect, any) error Select(dbxGetSelect, any) error Clear() String() string }
Click to show internal directories.
Click to hide internal directories.