utils

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFormatFlag

func AddFormatFlag(flags *pflag.FlagSet, formatPtr *Format)

func Contains

func Contains(array []string, str string) bool

func ConvertUnixTimeToTime

func ConvertUnixTimeToTime(timeUnix float64) time.Time

func DisplayTime

func DisplayTime(time time.Time) string

func GetAllPages

func GetAllPages[T any](
	ctx context.Context,
	client *aponoapi.AponoClient,
	nextPageFunc func(context.Context, *aponoapi.AponoClient, int32) ([]T, *clientapi.PaginationClientInfoModel, error),
) ([]T, error)

func IsDateAfterDaysOffset

func IsDateAfterDaysOffset(date time.Time, daysOffset int64) bool

func IsFlagSet

func IsFlagSet(cmd *cobra.Command, flagName string) bool

func IsValidUUID

func IsValidUUID(u string) bool

func PrintObjectsAsJSON

func PrintObjectsAsJSON(writer io.Writer, objects any) error

func PrintObjectsAsYaml

func PrintObjectsAsYaml(writer io.Writer, objects any) error

func ReturnAPIResponseError

func ReturnAPIResponseError(resp *http.Response) error

Types

type Format

type Format enumflag.Flag
const (
	TableFormat Format = iota
	JSONFormat
	YamlFormat
)

Jump to

Keyboard shortcuts

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