util

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Day   = 24 * time.Hour
	Month = 30 * Day
	Year  = 365 * Day
)

Time units for calculating durations in time.Duration.

Variables

This section is empty.

Functions

func InitMajordomo added in v0.7.0

func InitMajordomo(ctx context.Context) (majordomo.Service, error)

InitMajordomo initialises the majordomo service, for fetching secrets.

func LogLevel

func LogLevel(path string) zerolog.Level

LogLevel returns the best log level for the path.

func ResolvePath added in v0.7.0

func ResolvePath(path string) string

ResolvePath resolves a potentially relative path to an absolute path.

Types

type CalendarDuration added in v0.7.0

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

CalendarDuration represents a calendar-based duration.

func MustParseCalendarDuration added in v0.7.0

func MustParseCalendarDuration(duration string) *CalendarDuration

MustParseCalendarDuration parses a duration string, panicking on error.

func ParseCalendarDuration added in v0.7.0

func ParseCalendarDuration(duration string) (*CalendarDuration, error)

ParseCalendarDuration parses a duration string and returns a calendar duration.

func (*CalendarDuration) Adverb added in v0.7.0

func (d *CalendarDuration) Adverb() string

Adverb converts CalendarDuration to an English adverb (Daily / Yearly, etc).

func (*CalendarDuration) Days added in v0.7.0

func (d *CalendarDuration) Days() int

Days returns this duration's days.

func (*CalendarDuration) Decrement added in v0.7.0

func (d *CalendarDuration) Decrement(date time.Time) time.Time

Decrement decrements the date by the duration.

func (*CalendarDuration) Hours added in v0.7.0

func (d *CalendarDuration) Hours() int

Hours returns this duration's hours.

func (*CalendarDuration) Increment added in v0.7.0

func (d *CalendarDuration) Increment(date time.Time) time.Time

Increment increments the date by the duration.

func (*CalendarDuration) Minutes added in v0.7.0

func (d *CalendarDuration) Minutes() int

Minutes returns this duration's minutes.

func (*CalendarDuration) Months added in v0.7.0

func (d *CalendarDuration) Months() int

Months returns this duration's months.

func (*CalendarDuration) Mul added in v0.7.0

func (d *CalendarDuration) Mul(times int) *CalendarDuration

Mul performs multiplication for CalendarDuration.

func (*CalendarDuration) Seconds added in v0.7.0

func (d *CalendarDuration) Seconds() int

Seconds returns this duration's seconds.

func (*CalendarDuration) String added in v0.7.0

func (d *CalendarDuration) String() string

String returns the ISO-8601 period string.

func (*CalendarDuration) ToDuration added in v0.7.0

func (d *CalendarDuration) ToDuration() time.Duration

ToDuration converts CalendarDuration to time.Duration.

func (*CalendarDuration) Years added in v0.7.0

func (d *CalendarDuration) Years() int

Years returns this duration's years.

Jump to

Keyboard shortcuts

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