ablyutil

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After added in v1.2.0

func After(ctx context.Context, d time.Duration) <-chan time.Time

After returns a channel that is sent the current time once the given duration has passed. If the context is cancelled before that, the channel is immediately closed.

func BaseID added in v1.1.0

func BaseID() (string, error)

BaseID returns a base64 encoded 9 random bytes to be used in idempotent rest publishing as part of message id.

Spec RSL1k1

func ContextWithTimeout added in v1.2.0

func ContextWithTimeout(ctx context.Context, after TimerFunc, timeout time.Duration) (context.Context, context.CancelFunc)

ContextWithTimeout is like context.WithTimeout, but using the provided TimerFunc for setting the timer.

func MarshalMsgpack added in v1.2.0

func MarshalMsgpack(v interface{}) ([]byte, error)

MarshalMsgpack returns msgpack encoding of v

func Merge

func Merge(orig, v interface{}, defaults bool)

merge iterates over fields of struct pointed by v and when it's non-zero, copies its value to corresponding filed in orig.

merge assumes both orig and v are pointers to a struct value of the same type.

When defaults is true, merge uses v as the source of default values for each field; the default is copied when orig's field is a zero-value.

func UnmarshalMsgpack added in v1.2.0

func UnmarshalMsgpack(data []byte, v interface{}) error

UnmarshalMsgpack decodes the MessagePack-encoded data and stores the result in the value pointed to by v.

Types

type TimerFunc added in v1.2.0

type TimerFunc func(context.Context, time.Duration) <-chan time.Time

func NewTicker added in v1.2.0

func NewTicker(after TimerFunc) TimerFunc

NewTicker repeatedly calls the given TimerFunc, which should behave like After, until the context it cancelled. It returns a channel to which it sends every value produced by the TimerFunc.

Jump to

Keyboard shortcuts

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