Documentation ¶
Overview ¶
Helper functions for reading/writing data.
Index ¶
- func ReadFile(filePath string) string
- func ReadMapOrNil(filePath string) map[string]string
- func ReadWeb(url string) (string, error)
- func ReadWebMulti(urls []string) []string
- func ReadWebMultiMap[K comparable](keys []K, keyToUrl func(K) string) map[K]string
- func ReadWebRequired(url string) string
- func WriteFile(filePath string, content string)
- func WriteFileLines(filePath string, lines []string)
- func WriteMapCustomSort(filePath string, contents map[string]string, sortFunc func(a, b string) int)
- func WriteMapSortByIntKey(filePath string, contents map[string]string)
- func WriteProtoArrayToBuffer[T googleProto.Message](arr []T, buffer *bytes.Buffer, name string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadMapOrNil ¶
func ReadWeb ¶ added in v0.1.14
Fetches web results a single url, and returns the page contents as a string.
func ReadWebMulti ¶
Fetches web results from all the given urls, and returns a parallel array of page contents.
func ReadWebMultiMap ¶
func ReadWebMultiMap[K comparable](keys []K, keyToUrl func(K) string) map[K]string
Like ReadWebMulti, but uses a lambda function for converting keys --> urls and returns a map of keys to web contents.
func ReadWebRequired ¶ added in v0.1.14
func WriteFileLines ¶
func WriteMapCustomSort ¶ added in v0.1.6
func WriteMapSortByIntKey ¶ added in v0.1.6
func WriteProtoArrayToBuffer ¶ added in v0.1.46
func WriteProtoArrayToBuffer[T googleProto.Message](arr []T, buffer *bytes.Buffer, name string)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.