util

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WxServerUrl = "https://api.weixin.qq.com"

微信 api 服务器地址

Functions

func Format

func Format(t *time.Time) (v string)

格式化时间

func If

func If(b bool, t, f interface{}) interface{}

模拟三元操作

func JsonDecode

func JsonDecode(s string, out interface{}) error

转JSON

func JsonEncode

func JsonEncode(v interface{}) string

转JSON

func StrToTime

func StrToTime(s string) *time.Time

时间字符串转换成时间对象

Types

type Client

type Client struct {
	*context.Context
}

func NewHttpClient

func NewHttpClient(ctx *context.Context) (client *Client)

获取实例

func (*Client) HttpPostJson

func (c *Client) HttpPostJson(path string, params string, headers ...map[string]string) (body string, err error)

POST

func (*Client) Upload added in v1.0.1

func (c *Client) Upload(path, filename string) (body string, err error)

上传图片

type CustomerFormatter

type CustomerFormatter struct {
	Prefix string
}

func (*CustomerFormatter) Format

func (s *CustomerFormatter) Format(entry *logrus.Entry) ([]byte, error)

Jump to

Keyboard shortcuts

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