Documentation ¶
Index ¶
- Constants
- func Abs(x int) int
- func Base64Encode(s string) string
- func ConvertSizeToBytes(size string) int
- func CurrentUTCTime() string
- func EncodePrivateKeyToPEM(privateKey *rsa.PrivateKey) []byte
- func EnsureDirExist(name string) error
- func FileExists(name string) bool
- func GbkToUtf8(s []byte) ([]byte, error)
- func GeneratePrivateKey(bitSize int) (*rsa.PrivateKey, error)
- func GetValidString(s string, position int, positive bool) string
- func GzipCompressFile(srcPath, dstPath string) error
- func HTTPGMTDate() string
- func MD5Encode(b []byte) string
- func MakeSignature(key, date string) string
- func MakeSureDirExit(filePath string)
- func Sum(i []int) int
- func Utf8ToGbk(s []byte) ([]byte, error)
- func WriteKeyToFile(keyBytes []byte, saveFileTo string) error
- type Client
- func (c *Client) Delete(url string, res interface{}, params ...map[string]string) (resp *http.Response, err error)
- func (c *Client) Do(method, url string, data, res interface{}, params ...map[string]string) (resp *http.Response, err error)
- func (c *Client) Get(url string, res interface{}, params ...map[string]string) (resp *http.Response, err error)
- func (c *Client) NewRequest(method, url string, body interface{}, params []map[string]string) (req *http.Request, err error)
- func (c *Client) Patch(url string, data interface{}, res interface{}, params ...map[string]string) (resp *http.Response, err error)
- func (c *Client) Post(url string, data interface{}, res interface{}, params ...map[string]string) (resp *http.Response, err error)
- func (c *Client) PostForm(url string, data interface{}, res interface{}) (err error)
- func (c *Client) Put(url string, data interface{}, res interface{}, params ...map[string]string) (resp *http.Response, err error)
- func (c *Client) SetAuth(auth ClientAuth)
- func (c *Client) SetBasicAuth(username, password string)
- func (c *Client) SetCookie(k, v string)
- func (c *Client) SetHeader(k, v string)
- func (c *Client) SetReqHeaders(req *http.Request, params []map[string]string)
- func (c *Client) UploadFile(url string, gFile string, res interface{}, params ...map[string]string) (err error)
- type ClientAuth
- type Pagination
- func (p *Pagination) CurrentPage() int
- func (p *Pagination) GetNextPageData() []interface{}
- func (p *Pagination) GetPageData(pageIndex int) []interface{}
- func (p *Pagination) GetPrevPageData() []interface{}
- func (p *Pagination) HasNext() bool
- func (p *Pagination) HasPrev() bool
- func (p *Pagination) PageSize() int
- func (p *Pagination) SetPageSize(size int)
- func (p *Pagination) TotalCount() int
- func (p *Pagination) TotalPage() int
- type UrlParser
- type WrapperTable
Constants ¶
View Source
const ( TruncSuffix = iota TruncPrefix TruncMiddle )
Variables ¶
This section is empty.
Functions ¶
func Base64Encode ¶
func ConvertSizeToBytes ¶
func CurrentUTCTime ¶
func CurrentUTCTime() string
func EncodePrivateKeyToPEM ¶
func EncodePrivateKeyToPEM(privateKey *rsa.PrivateKey) []byte
func EnsureDirExist ¶
func FileExists ¶
func GeneratePrivateKey ¶
func GeneratePrivateKey(bitSize int) (*rsa.PrivateKey, error)
func GzipCompressFile ¶
func HTTPGMTDate ¶
func HTTPGMTDate() string
func MakeSignature ¶
func MakeSureDirExit ¶
func MakeSureDirExit(filePath string)
func WriteKeyToFile ¶
Types ¶
type Client ¶
type Client struct { Timeout time.Duration Headers map[string]string Auth ClientAuth BaseHost string UrlParsers []UrlParser // contains filtered or unexported fields }
func (*Client) Do ¶
func (c *Client) Do(method, url string, data, res interface{}, params ...map[string]string) (resp *http.Response, err error)
Do wrapper http.Client Do() for using auth and error handle params:
- query string if set {"name": "ibuler"}
func (*Client) NewRequest ¶
func (*Client) SetAuth ¶
func (c *Client) SetAuth(auth ClientAuth)
func (*Client) SetBasicAuth ¶
func (*Client) SetReqHeaders ¶
type ClientAuth ¶
type ClientAuth interface {
Sign() (date, sign string)
}
type Pagination ¶
type Pagination struct {
// contains filtered or unexported fields
}
func NewPagination ¶
func NewPagination(data []interface{}, size int) *Pagination
func (*Pagination) CurrentPage ¶
func (p *Pagination) CurrentPage() int
func (*Pagination) GetNextPageData ¶
func (p *Pagination) GetNextPageData() []interface{}
func (*Pagination) GetPageData ¶
func (p *Pagination) GetPageData(pageIndex int) []interface{}
func (*Pagination) GetPrevPageData ¶
func (p *Pagination) GetPrevPageData() []interface{}
func (*Pagination) HasNext ¶
func (p *Pagination) HasNext() bool
func (*Pagination) HasPrev ¶
func (p *Pagination) HasPrev() bool
func (*Pagination) PageSize ¶
func (p *Pagination) PageSize() int
func (*Pagination) SetPageSize ¶
func (p *Pagination) SetPageSize(size int)
func (*Pagination) TotalCount ¶
func (p *Pagination) TotalCount() int
func (*Pagination) TotalPage ¶
func (p *Pagination) TotalPage() int
type WrapperTable ¶
type WrapperTable struct { Labels []string Fields []string FieldsSize map[string][3]int // 列宽,列最小宽,列最大宽 Data []map[string]string TotalSize int TruncPolicy int Caption string // contains filtered or unexported fields }
func (*WrapperTable) CalculateColumnsSize ¶
func (t *WrapperTable) CalculateColumnsSize()
func (*WrapperTable) Display ¶
func (t *WrapperTable) Display() string
func (*WrapperTable) Initial ¶
func (t *WrapperTable) Initial()
Click to show internal directories.
Click to hide internal directories.