ctx

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: MulanPSL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CrondWait = time.Second * 2
	CrondMust = time.Millisecond * 500
)

推荐执行时间

View Source
const (
	TimeDev = time.Minute * 10
)

推荐时间

Variables

View Source
var ErrCtxTimeout = errors.New("上下文通知请求结束")

上下文错误 @author fuzeyu

Functions

func IsCancel

func IsCancel(ctx context.Context) bool

检查一个上下文是否被执行取消 @param ctx 上下文对象

func NewContext

func NewContext(timeout time.Duration) context.Context

创建一个指定超时时间的上下文 @param timeout 超时时间

func NewContextWithReuqest

func NewContextWithReuqest() context.Context

请求时间

func StartCrondWithTimestamp

func StartCrondWithTimestamp(label string, callback CrondCallback)

开始执行一个定时器方法 @param callback 回调方法

func TomorrowWaitDuration

func TomorrowWaitDuration(currentTimestamp, waitSeconds int64) time.Duration

获取明天指定秒数的一个时间戳 @param currentTimestamp 当前时间戳 @param waitSeconds 等待时间

Types

type CrondCallback

type CrondCallback func(int642 int64) time.Duration

定时器执行方法 @author fuzeyu

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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