Documentation ¶
Overview ¶
Package historianutils is a library of common utility functions for Battery Historian processing.
Index ¶
- Variables
- func AbsFloat32(x float32) float32
- func ErrorsToString(errs []error) string
- func GzipCompress(uncompressed []byte) ([]byte, error)
- func MaxInt64(a int64, b int64) int64
- func ParseDurationWithDays(input string) (int64, error)
- func RunCommand(name string, args ...string) (string, error)
- func ScrubPII(input string) string
- func SubexpNames(r *regexp.Regexp, s string) (bool, map[string]string)
Constants ¶
This section is empty.
Variables ¶
var ( // ServiceDumpRE is a regular expression to match the beginning of a service dump. ServiceDumpRE = regexp.MustCompile(`^DUMP\s+OF\s+SERVICE\s+(?P<service>\S+):`) )
Functions ¶
func AbsFloat32 ¶
AbsFloat32 returns the absolute value of a float32 number.
func ErrorsToString ¶
ErrorsToString converts an array of errors into a newline delimited string.
func GzipCompress ¶
GzipCompress compresses byte data.
func ParseDurationWithDays ¶
ParseDurationWithDays parses a duration string and returns the milliseconds. e.g. 3d1h2m This is the same as Golang's time.ParseDuration, but also handles days. Assumes days are 24 hours, which is not exact but usually good enough for what we care about.
func RunCommand ¶
RunCommand executes the given command and returns the output.
func ScrubPII ¶
ScrubPII scrubs any part of the string that looks like PII (eg. an email address). From:
com.google.android.apps.plus.content.EsProvider/com.google/john.doe@gmail.com/extra or *sync*/com.app.android.conversations/com.app.android.account/Mr. Noogler
To:
com.google.android.apps.plus.content.EsProvider/com.google/XXX@gmail.com/extra or *sync*/com.app.android.conversations/com.app.android.account/XXX
Types ¶
This section is empty.