utils

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadImage

func DownloadImage(ctx context.Context, url string, scale string, path string) (string, error)

DownloadImage download image with a specific scale, depend on ffmpeg

func Mail

func Mail(to []string, title string, content string) error

Mail send mail in HTML format

func OptimizeImage

func OptimizeImage(ctx context.Context, path string, scale string) (string, error)

OptimizeImage make image limited in a specific scaling

func SaveImage

func SaveImage(ctx context.Context, file File, scale string, path string) (string, error)

SaveImage save image with a specific scale, depend on ffmpeg

func SaveVideo added in v1.0.5

func SaveVideo(ctx context.Context, file File, scale string, time int, path string) (string, string, error)

SaveVideo save video with a specific scale, depend on ffmpeg

func WxDecrypt

func WxDecrypt(data []byte, platformKey string) ([]byte, error)

WxDecrypt 第三方平台消息解密

func WxDecryptUserInfo added in v1.0.11

func WxDecryptUserInfo(data string, key string, iv string) (string, error)

WxDecryptUserInfo 小程序UserInfo解密

func WxEncrypt

func WxEncrypt(data []byte, platformKey, platformAppid string) ([]byte, error)

WxEncrypt 第三方平台消息加密

func WxSign

func WxSign(timestamp, nonce, encrypt, token string) string

WxSign 第三方平台签名

Types

type File

type File interface {
	io.Reader
	io.Seeker
}

File interface

type Graphql

type Graphql struct {
	URL       string
	Query     string
	Variables map[string]interface{}
	Operation string
	Headers   req.Header
}

Graphql struct

func (*Graphql) Fetch

func (g *Graphql) Fetch(ctx context.Context, result interface{}) error

Fetch execute a graphql api

type WxAPI

type WxAPI struct {
	Method  string
	URI     string
	Query   req.QueryParam
	Body    map[string]interface{}
	Headers req.Header
}

WxAPI struct

func (*WxAPI) Fetch

func (w *WxAPI) Fetch(ctx context.Context, result interface{}) error

Fetch execute a wx api

Jump to

Keyboard shortcuts

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