Documentation ¶
Index ¶
- Constants
- func Base64DecodeFilename(src string) ([]byte, error)
- func Base64DecodeMap(str string) (data map[string]any, err error)
- func Base64EncodeFilename(src string) string
- func Base64EncodeMap(data map[string]any) string
- func ExampleRequestTmpls() string
- func NTSFunc(delay int64) http.HandlerFunc
- func SegnmentsDiv(length, num int) (segs [][2]int)
- func SortSliceOfSlice[T constraints.Ordered](slice [][]T)
- func ValidJSON(bts []byte) (err error)
- type BatchProcess
- type Email
- type NetworkTimeResult
- type NetworkTimeServer
- type Output
- type Parallel
- type RequestTmpl
- type RequestTmpls
- type Sender
- type SigningMd5
Constants ¶
View Source
const ( BP_StatusReady = 0 BP_StatusRunning = 1 BP_StatusClosed = -1 )
Variables ¶
This section is empty.
Functions ¶
func Base64DecodeFilename ¶
replace +/ with -_
func Base64EncodeMap ¶
func ExampleRequestTmpls ¶
func ExampleRequestTmpls() string
func NTSFunc ¶
func NTSFunc(delay int64) http.HandlerFunc
func SegnmentsDiv ¶
func SortSliceOfSlice ¶
func SortSliceOfSlice[T constraints.Ordered](slice [][]T)
demo:
[[1,2], [3]] => [[3], [1,2]] [[2,1], [1,2]] => [[1,2], [2, 1]]
Types ¶
type BatchProcess ¶
type BatchProcess[T any] struct { // contains filtered or unexported fields }
func NewBatchProcess ¶
func (*BatchProcess[T]) Down ¶
func (bp *BatchProcess[T]) Down()
func (*BatchProcess[T]) Recv ¶
func (bp *BatchProcess[T]) Recv(v T) (err error)
type NetworkTimeResult ¶
type NetworkTimeResult struct { T1 time.Time `json:"t1"` T2 time.Time `json:"t2"` T3 time.Time `json:"t3"` T4 time.Time `json:"t4"` Sigma int64 `json:"sigma"` Delta int64 `json:"delta"` }
func GetNetworkTime ¶
func GetNetworkTime(addr string, delay int64) (result *NetworkTimeResult, err error)
func (NetworkTimeResult) String ¶
func (result NetworkTimeResult) String() string
type NetworkTimeServer ¶
https://en.wikipedia.org/wiki/Network_Time_Protocol https://en.wikipedia.org/wiki/File:NTP-Algorithm.svg
func NewNetworkTimeServer ¶
func NewNetworkTimeServer(addr string, delay int64) (ser *NetworkTimeServer, err error)
func (*NetworkTimeServer) Run ¶
func (ser *NetworkTimeServer) Run() error
type Output ¶
type Parallel ¶
type Parallel struct {
// contains filtered or unexported fields
}
func NewParallel ¶
type RequestTmpl ¶
type RequestTmpl struct { Name string `mapstructure:"name"` Method string `mapstructure:"method"` Path string `mapstructure:"path"` Params string `mapstructure:"params"` Body string `mapstructure:"body"` NoPublicHeaders bool `mapstructure:"no_public_headers"` Headers map[string]string `mapstructure:"headers"` Outputs []Output `mapstructure:"outputs"` }
type RequestTmpls ¶
type RequestTmpls struct { Url string `mapstructure:"url"` Headers map[string]string `mapstructure:"headers"` Prelude []RequestTmpl `mapstructure:"prelude"` APIs []RequestTmpl `mapstructure:"apis"` // contains filtered or unexported fields }
func LoadRequestTmpls ¶
func LoadRequestTmpls(name, fp string) (item *RequestTmpls, err error)
func (*RequestTmpls) Match ¶
func (item *RequestTmpls) Match(names ...string) (tmpls []*RequestTmpl, err error)
func (*RequestTmpls) Request ¶
func (item *RequestTmpls) Request(tmpl *RequestTmpl) ( statusCode int, body string, err error)
type Sender ¶
type SigningMd5 ¶
type SigningMd5 struct {
// contains filtered or unexported fields
}
func NewSigningMd5 ¶
func NewSigningMd5(secrete, key string, lowcase bool) (*SigningMd5, error)
func (*SigningMd5) SignQuery ¶
func (sign *SigningMd5) SignQuery(param map[string]string) (query string)
func (*SigningMd5) SignValues ¶
func (sign *SigningMd5) SignValues(param map[string]string) (value string)
func (*SigningMd5) VerifyQuery ¶
func (sign *SigningMd5) VerifyQuery(query string) (err error)
Click to show internal directories.
Click to hide internal directories.