util

package
v0.0.0-...-2f9bd9a Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidDuration = errors.New("invalid duration")

Functions

func Compare1DInt64

func Compare1DInt64(i1, i2 []int64) bool

func Compare1DUInt64

func Compare1DUInt64(i1, i2 []uint64) bool

func Compare2DInt64

func Compare2DInt64(i1, i2 [][]int64) bool

func Compare2DUInt64

func Compare2DUInt64(i1, i2 [][]uint64) bool

func Copy1DInt64

func Copy1DInt64(i []int64) []int64

func Copy1DUInt64

func Copy1DUInt64(i []uint64) []uint64

func Copy2DInt64

func Copy2DInt64(i [][]int64) [][]int64

func Copy2DUInt64

func Copy2DUInt64(i [][]uint64) [][]uint64

func FileExists

func FileExists(path string) bool

FileExists checks if file exists

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration formats a duration to a string.

func IndexOfInt

func IndexOfInt(a []int, element int) int

IndexOfInt returns the index of the first element of 'column' that matches 'element' returns -1 if no element matches

func IndexOfInt64

func IndexOfInt64(column []int64, element int64) int

IndexOfInt64 returns the index of the first element of 'column' that matches 'element' returns -1 if no element matches

func InsertFileBlock

func InsertFileBlock(file *os.File, offset, length int64) error

InsertFileBlock uses fallocate syscall to insert one or multiple empty blocks in the middle of a file, pushing back the contents that follow

func IsSubset

func IsSubset(a map[string]string, b map[string]string) bool

IsSubset checks if map a is a subset of map b

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses a time duration from a string. This is needed instead of time.ParseDuration because this will support the full syntax that InfluxQL supports for specifying durations including weeks and days.

func ReadBlock

func ReadBlock(r io.Reader) (bytes.Buffer, error)

ReadBlock reads a 4k block from a reader and returns it as bytes.Buffer

func RoundDown

func RoundDown(value, modulo int64) int64

RoundDown rounds down value to next multiple of modulo only works for positive integers

func RoundUp

func RoundUp(value, modulo int64) int64

RoundUp rounds down value to next multiple of modulo only works for positive integers

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