util

package
v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: Apache-2.0 Imports: 10 Imported by: 1,796

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDirIfMissing

func CreateDirIfMissing(dirPath string) (bool, error)

CreateDirIfMissing creates a dir for dirPath if not already exists. If the dir is empty it returns true

func DecodeOrderPreservingVarUint64

func DecodeOrderPreservingVarUint64(bytes []byte) (uint64, int, error)

DecodeOrderPreservingVarUint64 decodes the number from the bytes obtained from method 'EncodeOrderPreservingVarUint64'. It returns the decoded number, the number of bytes that are consumed in the process, and an error if the input bytes are invalid.

func DirEmpty

func DirEmpty(dirPath string) (bool, error)

DirEmpty returns true if the dir at dirPath is empty

func EncodeOrderPreservingVarUint64

func EncodeOrderPreservingVarUint64(number uint64) []byte

EncodeOrderPreservingVarUint64 returns a byte-representation for a uint64 number such that all zero-bits starting bytes are trimmed in order to reduce the length of the array For preserving the order in a default bytes-comparison, first byte contains the number of remaining bytes. The presence of first byte also allows to use the returned bytes as part of other larger byte array such as a composite-key representation in db

func FileExists

func FileExists(filePath string) (bool, int64, error)

FileExists checks whether the given file exists. If the file exists, this method also returns the size of the file.

func ListSubdirs

func ListSubdirs(dirPath string) ([]string, error)

ListSubdirs returns the subdirectories

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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