interceptor

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlignPrecision

func AlignPrecision(start, end string) (_, _ string)

AlignPrecision aligns the two time strings to same precision by truncating the more precise one

func BeforeChain

func BeforeChain(beforeFunctions []cli.BeforeFunc) cli.BeforeFunc

BeforeChain is a convenient function to chain up multiple cli.BeforeFunc

func DurationInterceptor

func DurationInterceptor(ctx *cli.Context) error

DurationInterceptor sets the duration if absent, and formats it accordingly, see ParseDuration

func ParseDuration

func ParseDuration(start, end string) (startTime, endTime time.Time, step schema.Step)

ParseDuration parses the `start` and `end` to a triplet, (startTime, endTime, step) if --start and --end are both absent,

then: start := now - 30min; end := now

if --start is given, --end is absent,

then: end := now + 30 units, where unit is the precision of `start`, (hours, minutes, etc.)

if --start is absent, --end is given,

then: start := end - 30 unis, where unit is the precision of `end`, (hours, minutes, etc.)

NOTE that when either(both) `start` or `end` is(are) given, there is no timezone info in the format, (e.g. 2019-11-09 1001), so they'll be considered as UTC-based, and generate the missing `start`(`end`) based on the same timezone, UTC

Types

This section is empty.

Jump to

Keyboard shortcuts

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