util

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeModeIfNot added in v0.4.0

func ChangeModeIfNot(src string, mode os.FileMode) error

ChangeModeIfNot Change the permission mode of a file if it is not the same as the specified mode

func CompareVersion

func CompareVersion(v1, v2 string) int

func CopyFile

func CopyFile(src, dst string) error

func FileExists

func FileExists(filename string) bool

func GetBeginOfToday

func GetBeginOfToday() int64

func GetTimestamp

func GetTimestamp() int64

func IsBeforeToday

func IsBeforeToday(timestamp int64) bool

func MoveFiles added in v0.2.3

func MoveFiles(src, targetDir string) error

MoveFiles Move a folder or file to a specified directory

Types

type ArchType

type ArchType string

func GetArchType

func GetArchType() ArchType

type Decompressor

type Decompressor interface {
	Decompress(dest string) error
}

func NewDecompressor

func NewDecompressor(src string) Decompressor

type Downloader

type Downloader struct {
	// URL is the URL to download the SDK from.
	LocalPath string `json:"local_path"`
}

func NewDownloader

func NewDownloader(localPath string) *Downloader

func (*Downloader) Download

func (d *Downloader) Download(url *url.URL) (string, error)

type ErrorStore added in v0.4.2

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

ErrorStore is a struct that stores errors

func NewErrorStore added in v0.4.2

func NewErrorStore() *ErrorStore

NewErrorStore creates a new ErrorStore

func (*ErrorStore) Add added in v0.4.2

func (e *ErrorStore) Add(note string, err error)

Add adds an error to the store

func (*ErrorStore) AddAndShow added in v0.4.2

func (e *ErrorStore) AddAndShow(note string, err error)

Add and show in the console

func (*ErrorStore) GetNotes added in v0.4.2

func (e *ErrorStore) GetNotes() []string

get all error notes

func (*ErrorStore) GetNotesSet added in v0.4.2

func (e *ErrorStore) GetNotesSet() Set[string]

get notes set

func (*ErrorStore) HasError added in v0.4.2

func (e *ErrorStore) HasError() bool

type GzipTarDecompressor

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

func (*GzipTarDecompressor) Decompress

func (g *GzipTarDecompressor) Decompress(dest string) error

type MapSet added in v0.2.5

type MapSet[T comparable] struct {
	// contains filtered or unexported fields
}

func (*MapSet[T]) Add added in v0.2.5

func (s *MapSet[T]) Add(v T) bool

func (*MapSet[T]) Contains added in v0.2.5

func (s *MapSet[T]) Contains(v T) bool

func (*MapSet[T]) Len added in v0.2.5

func (s *MapSet[T]) Len() int

func (*MapSet[T]) Remove added in v0.2.5

func (s *MapSet[T]) Remove(v T)

func (*MapSet[T]) Slice added in v0.2.5

func (s *MapSet[T]) Slice() []T

type OSType

type OSType string

func GetOSType

func GetOSType() OSType

type Set added in v0.2.5

type Set[T comparable] interface {
	Add(v T) bool
	Remove(v T)
	Contains(v T) bool
	Len() int
	Slice() []T
}

func NewSet added in v0.2.5

func NewSet[T comparable]() Set[T]

func NewSetWithSlice added in v0.2.5

func NewSetWithSlice[T comparable](slice []T) Set[T]

func NewSortedSet added in v0.2.5

func NewSortedSet[T comparable]() Set[T]

func NewSortedSetWithSlice added in v0.2.5

func NewSortedSetWithSlice[T comparable](slice []T) Set[T]

type SevenZipDecompressor added in v0.3.2

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

func (*SevenZipDecompressor) Decompress added in v0.3.2

func (s *SevenZipDecompressor) Decompress(dest string) error

type SortedSet added in v0.2.5

type SortedSet[T comparable] struct {
	// contains filtered or unexported fields
}

func (*SortedSet[T]) Add added in v0.2.5

func (s *SortedSet[T]) Add(v T) bool

func (*SortedSet[T]) Contains added in v0.2.5

func (s *SortedSet[T]) Contains(v T) bool

func (*SortedSet[T]) Len added in v0.2.5

func (s *SortedSet[T]) Len() int

func (*SortedSet[T]) Remove added in v0.2.5

func (s *SortedSet[T]) Remove(v T)

func (*SortedSet[T]) Slice added in v0.2.5

func (s *SortedSet[T]) Slice() []T

type VersionSort added in v0.4.0

type VersionSort []string

func (VersionSort) Len added in v0.4.0

func (s VersionSort) Len() int

func (VersionSort) Less added in v0.4.0

func (s VersionSort) Less(i, j int) bool

func (VersionSort) Swap added in v0.4.0

func (s VersionSort) Swap(i, j int)

type XZTarDecompressor

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

func (*XZTarDecompressor) Decompress

func (g *XZTarDecompressor) Decompress(dest string) error

type ZipDecompressor

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

func (*ZipDecompressor) Decompress

func (z *ZipDecompressor) Decompress(dest string) error

Jump to

Keyboard shortcuts

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