util

package
v0.0.0-...-6442e4a Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseBool

func ParseBool(b string) *bool

ParseBool parses a string into a boolean pointer.

func ParsePInt64s

func ParsePInt64s(ss []string) ([]*int64, error)

ParsePInt64s parses a slice of strings into a slice of int64 pointers.

func ParseUint32s

func ParseUint32s(ss []string) ([]uint32, error)

ParseUint32s parses a slice of strings into a slice of uint32s.

func ParseUint64s

func ParseUint64s(ss []string) ([]uint64, error)

ParseUint64s parses a slice of strings into a slice of uint64s.

func ReadUintFromFile

func ReadUintFromFile(path string) (uint64, error)

ReadUintFromFile reads a file and attempts to parse a uint64 from it.

func SysReadFile

func SysReadFile(file string) (string, error)

SysReadFile is a simplified ioutil.ReadFile that invokes syscall.Read directly. https://github.com/Schneizelw/mtggokit/metrics/metricslog/node_exporter/pull/728/files

Types

type ValueParser

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

A ValueParser enables parsing a single string into a variety of data types in a concise and safe way. The Err method must be invoked after invoking any other methods to ensure a value was successfully parsed.

func NewValueParser

func NewValueParser(v string) *ValueParser

NewValueParser creates a ValueParser using the input string.

func (*ValueParser) Err

func (vp *ValueParser) Err() error

Err returns the last error, if any, encountered by the ValueParser.

func (*ValueParser) PInt64

func (vp *ValueParser) PInt64() *int64

PInt64 interprets the underlying value as an int64 and returns a pointer to that value.

func (*ValueParser) PUInt64

func (vp *ValueParser) PUInt64() *uint64

PUInt64 interprets the underlying value as an uint64 and returns a pointer to that value.

Jump to

Keyboard shortcuts

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