package util
import "github.com/prometheus/procfs/internal/util"
Index ¶
- func ParseBool(b string) *bool
- func ParseUint32s(ss []string) ([]uint32, error)
- func ParseUint64s(ss []string) ([]uint64, error)
- func ReadUintFromFile(path string) (uint64, error)
- func SysReadFile(file string) (string, error)
- type ValueParser
Functions ¶
func ParseBool ¶
ParseBool parses a string into a boolean pointer.
func ParseUint32s ¶
ParseUint32s parses a slice of strings into a slice of uint32s.
func ParseUint64s ¶
ParseUint64s parses a slice of strings into a slice of uint64s.
func ReadUintFromFile ¶
ReadUintFromFile reads a file and attempts to parse a uint64 from it.
func SysReadFile ¶
SysReadFile is here implemented as a noop for builds that do not support the read syscall. For example Windows, or Linux on Google App Engine.
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.
Source Files ¶
parse.go sysreadfile_compat.go valueparser.go
- Version
- v0.0.3
- Published
- Jun 25, 2019
- Platform
- js/wasm
- Imports
- 4 packages
- Last checked
- 6 minutes ago –
Tools for package owners.