util

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "0.9.0"
View Source
const YearMonthLayout = "2006-01"

Variables

This section is empty.

Functions

func CreateDir

func CreateDir(dirName string) error

func DefaultConfig

func DefaultConfig(home string)

func ExactArgs

func ExactArgs(n int) cobra.PositionalArgs

ExactArgs returns an error if there are not exactly n args.

func FileExists

func FileExists(path string) (bool, error)

func GetWorkingDirectory

func GetWorkingDirectory() string

func MinimumNArgs

func MinimumNArgs(n int) cobra.PositionalArgs

MinimumNArgs returns an error if there is not at least N args.

func NewHttpClient

func NewHttpClient() *http.Client

func OpenOnBrowser

func OpenOnBrowser(url string) error

func ParseFloat

func ParseFloat(value string) (float64, error)

func ParseInteger

func ParseInteger(strCode string, codeType string) (int, error)

func ParseProductCode

func ParseProductCode(code string) (string, error)

func ParseYearMonth

func ParseYearMonth(yearMonth string) (time.Time, error)

func RangeArgs

func RangeArgs(min int, max int) cobra.PositionalArgs

RangeArgs returns an error if the number of args is not within the expected range.

func StringInList

func StringInList(str string, list []string) bool

func ToPrettyJson

func ToPrettyJson(body []byte) (string, error)

Types

type HttpGetManager

type HttpGetManager interface {
	Bytes(url string) ([]byte, error)
	PrettyJson(url string) (string, error)
	Type(url string, target interface{}) error
}

func NewHttpGetManager

func NewHttpGetManager() HttpGetManager

type HttpPostManager

type HttpPostManager interface {
	Bytes(url string, data []byte) ([]byte, error)
	PrettyJson(url string, data []byte) (string, error)
	FileWithDefaultName(remoteUrl string, directory string) (string, error)
	File(remoteUrl string, directory string, filename string) (string, error)
	Zip(remoteUrl string, directory string) (string, error)
}

func NewHttpPostManager

func NewHttpPostManager() HttpPostManager

type SamHttpGetManager

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

func (SamHttpGetManager) Bytes

func (s SamHttpGetManager) Bytes(url string) ([]byte, error)

func (SamHttpGetManager) PrettyJson

func (s SamHttpGetManager) PrettyJson(url string) (string, error)

func (SamHttpGetManager) Type

func (s SamHttpGetManager) Type(url string, target interface{}) error

type SamHttpPostManager

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

func (SamHttpPostManager) Bytes

func (s SamHttpPostManager) Bytes(url string, data []byte) ([]byte, error)

func (SamHttpPostManager) File

func (s SamHttpPostManager) File(remoteUrl string, directory string, filename string) (string, error)

func (SamHttpPostManager) FileWithDefaultName

func (s SamHttpPostManager) FileWithDefaultName(remoteUrl string, directory string) (string, error)

func (SamHttpPostManager) PrettyJson

func (s SamHttpPostManager) PrettyJson(url string, data []byte) (string, error)

func (SamHttpPostManager) Zip

func (s SamHttpPostManager) Zip(remoteUrl string, directory string) (string, error)

type SamTimeManager

type SamTimeManager struct{}

func (SamTimeManager) Now

func (SamTimeManager) Now() time.Time

type TimeManager

type TimeManager interface {
	Now() time.Time
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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