utils

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewID added in v0.7.3

func NewID() string

func TodayZero

func TodayZero(now time.Time) time.Time

TodayZero truncate time to today zero clock

func TomorrowZero

func TomorrowZero(now time.Time) time.Time

TomorrowZero round time to tomorrow zero clock

func TryDownloadBytes added in v0.6.2

func TryDownloadBytes(url string, retry int, retryInterval time.Duration) (int, []byte, error)

TryDownloadBytes try download bytes by url

func TryDownloadBytesWithHeader added in v0.7.0

func TryDownloadBytesWithHeader(url string, headers map[string]string, retry int, retryInterval time.Duration) (int, []byte, error)

TryDownloadBytesWithHeader try download bytes by url

func TryDownloadString added in v0.6.2

func TryDownloadString(url string, retry int, retryInterval time.Duration) (string, error)

TryDownloadString try download string by url

func TryDownloadStringWithHeader added in v0.7.0

func TryDownloadStringWithHeader(url string, headers map[string]string, retry int, retryInterval time.Duration) (string, error)

TryDownloadStringWithHeader try download string by url

func YesterdayZero added in v0.4.0

func YesterdayZero(now time.Time) time.Time

YesterdayZero truncate time to yesterday zero clock

Types

type GetAccessTokenResponse added in v0.6.0

type GetAccessTokenResponse struct {
	ErrorCode    int    `json:"errcode"`
	ErrorMessage string `json:"errmsg"`
	AccessToken  string `json:"access_token"`
	ExpiresIn    int64  `json:"expires_in"`
}

GetAccessTokenResponse response of get access token request

type WeChatMessageText added in v0.6.0

type WeChatMessageText struct {
	Content string `json:"content"`
}

WeChatMessageText wechat message text

type WeChatSendMessageRequest added in v0.6.0

type WeChatSendMessageRequest struct {
	ToUser      string            `json:"touser"`
	MessageType string            `json:"msgtype"`
	AgentID     int               `json:"agentid"`
	Text        WeChatMessageText `json:"text"`
	Safe        int               `json:"safe"`
}

WeChatSendMessageRequest wechat send message request

type WeChatSendMessageResponse added in v0.6.0

type WeChatSendMessageResponse struct {
	ErrorCode    int    `json:"errcode"`
	ErrorMessage string `json:"errmsg"`
	InvalidUser  string `json:"invaliduser"`
	InvalidParty string `json:"invalidparty"`
	InvalidTag   string `json:"invalidtag"`
}

WeChatSendMessageResponse wechat send message response

type WeChatService added in v0.6.0

type WeChatService struct {
	// contains filtered or unexported fields
}

WeChatService wechat service

func GetWeChatService added in v0.6.0

func GetWeChatService() *WeChatService

GetWeChatService get wechat service instance

func (WeChatService) GetAccessToken added in v0.6.0

func (s WeChatService) GetAccessToken() (string, error)

GetAccessToken return fresh access token

func (WeChatService) SendMessage added in v0.6.0

func (s WeChatService) SendMessage(message string) error

SendMessage send wechat message

Jump to

Keyboard shortcuts

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