Documentation ¶
Index ¶
- Variables
- func Cause(c context.Context) (err error)
- func NotOk(e error) error
- func OrOk(e error) error
- func RandomBytes(n int) []byte
- func WithCancelOrOk(ctx context.Context) (context.Context, context.CancelCauseFunc)
- type ParsableDuration
- func (d ParsableDuration) After() <-chan time.Time
- func (d ParsableDuration) AfterIf() <-chan time.Time
- func (d ParsableDuration) Clamp(lmin time.Duration, lmax time.Duration) ParsableDuration
- func (d ParsableDuration) IsPositive() bool
- func (d ParsableDuration) IsZero() bool
- func (d ParsableDuration) MarshalJSON() ([]byte, error)
- func (d ParsableDuration) MarshalText() ([]byte, error)
- func (d ParsableDuration) Max(o time.Duration) ParsableDuration
- func (d ParsableDuration) Min(o time.Duration) ParsableDuration
- func (d ParsableDuration) String() string
- func (d ParsableDuration) Timeout(ctx context.Context) (context.Context, context.CancelFunc)
- func (d ParsableDuration) TimeoutCause(ctx context.Context, cause error) (context.Context, context.CancelFunc)
- func (d *ParsableDuration) UnmarshalJSON(text []byte) (err error)
- func (d *ParsableDuration) UnmarshalText(text []byte) (err error)
- type ParsableSize
- func (d ParsableSize) IsPositive() bool
- func (d ParsableSize) IsZero() bool
- func (d ParsableSize) MarshalJSON() ([]byte, error)
- func (d ParsableSize) MarshalText() ([]byte, error)
- func (d ParsableSize) String() string
- func (d *ParsableSize) UnmarshalJSON(text []byte) (err error)
- func (d *ParsableSize) UnmarshalText(text []byte) (err error)
- type RuneSet
- type TimerRate
- func (d TimerRate) Clamp(rateMin TimerRate, rateMax TimerRate) TimerRate
- func (d TimerRate) ClampPeriod(pmin time.Duration, pmax time.Duration) TimerRate
- func (d TimerRate) Compare(o TimerRate) int
- func (d TimerRate) Faster(o TimerRate) bool
- func (d TimerRate) IsPositive() bool
- func (d TimerRate) IsZero() bool
- func (d TimerRate) MarshalText() ([]byte, error)
- func (d TimerRate) Rescale(period time.Duration) TimerRate
- func (d TimerRate) Slower(o TimerRate) bool
- func (d TimerRate) String() string
- func (d TimerRate) Ticks() uint32
- func (d TimerRate) ToTicks(t time.Time) uint32
- func (d *TimerRate) UnmarshalText(text []byte) (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrOk = fmt.Errorf("done")
View Source
var RunesAlpha = NewRuneSet(RunesLower.String(), RunesUpper.String())
View Source
var RunesAlphanum = NewRuneSet(RunesAlpha.String(), RunesNumeric.String())
View Source
var RunesLower = NewRuneSet("abcdefghijklmnopqrstuvwxyz")
View Source
var RunesNumeric = NewRuneSet("0123456789")
View Source
var RunesUpper = NewRuneSet("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
Functions ¶
func RandomBytes ¶
func WithCancelOrOk ¶
Types ¶
type ParsableDuration ¶
func Duration ¶
func Duration(d any) ParsableDuration
func (ParsableDuration) After ¶
func (d ParsableDuration) After() <-chan time.Time
If positive duration, returns a channel that will be given the current time after the duration has passed. If non-positive duration, returns a closed channel, which will be selected immediately.
func (ParsableDuration) AfterIf ¶
func (d ParsableDuration) AfterIf() <-chan time.Time
If positive duration, returns a channel that will be given the current time after the duration has passed. If non-positive duration, returns nil, which will never be selected.
func (ParsableDuration) Clamp ¶
func (d ParsableDuration) Clamp(lmin time.Duration, lmax time.Duration) ParsableDuration
Clamps the duration to the given range.
func (ParsableDuration) IsPositive ¶
func (d ParsableDuration) IsPositive() bool
func (ParsableDuration) IsZero ¶
func (d ParsableDuration) IsZero() bool
func (ParsableDuration) MarshalJSON ¶
func (d ParsableDuration) MarshalJSON() ([]byte, error)
func (ParsableDuration) MarshalText ¶
func (d ParsableDuration) MarshalText() ([]byte, error)
func (ParsableDuration) Max ¶
func (d ParsableDuration) Max(o time.Duration) ParsableDuration
func (ParsableDuration) Min ¶
func (d ParsableDuration) Min(o time.Duration) ParsableDuration
func (ParsableDuration) String ¶
func (d ParsableDuration) String() string
String representation of the duration.
func (ParsableDuration) Timeout ¶
func (d ParsableDuration) Timeout(ctx context.Context) (context.Context, context.CancelFunc)
func (ParsableDuration) TimeoutCause ¶
func (d ParsableDuration) TimeoutCause(ctx context.Context, cause error) (context.Context, context.CancelFunc)
Creates a context that will be cancelled after the duration has passed.
func (*ParsableDuration) UnmarshalJSON ¶
func (d *ParsableDuration) UnmarshalJSON(text []byte) (err error)
func (*ParsableDuration) UnmarshalText ¶
func (d *ParsableDuration) UnmarshalText(text []byte) (err error)
type ParsableSize ¶
type ParsableSize struct {
Value int
}
func Bytesize ¶
func Bytesize(d any) ParsableSize
func (ParsableSize) IsPositive ¶
func (d ParsableSize) IsPositive() bool
func (ParsableSize) IsZero ¶
func (d ParsableSize) IsZero() bool
func (ParsableSize) MarshalJSON ¶
func (d ParsableSize) MarshalJSON() ([]byte, error)
func (ParsableSize) MarshalText ¶
func (d ParsableSize) MarshalText() ([]byte, error)
func (ParsableSize) String ¶
func (d ParsableSize) String() string
func (*ParsableSize) UnmarshalJSON ¶
func (d *ParsableSize) UnmarshalJSON(text []byte) (err error)
func (*ParsableSize) UnmarshalText ¶
func (d *ParsableSize) UnmarshalText(text []byte) (err error)
type TimerRate ¶
func (TimerRate) ClampPeriod ¶
func (TimerRate) IsPositive ¶
func (TimerRate) MarshalText ¶
func (*TimerRate) UnmarshalText ¶
Click to show internal directories.
Click to hide internal directories.