{"modulePath":"github.com/spatialcurrent/go-stringify","version":"v0.0.0-20220308153339-0abf902cfee4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package stringify\n\nPackage stringify is a simple library for generating a stringer that converts literals to strings, converts map keys to strings, or converts a slice to a slice of strings.  This package is used by go-simple-serializer.\n\n  - [http://github.com/spatialcurrent/go-simple-serializer](http://github.com/spatialcurrent/go-simple-serializer)\n\n## Functions\n\n```go\nfunc Concat(in interface{}, stringer Stringer) (string, error)\n```\nConcat recursively flattens, stringifies, and concats an array or array of arrays.\n\n```go\nfunc InterfaceSliceToStringSlice(values []interface{}) []string\n```\nInterfaceSliceToStringSlice converts a slice of interface{} to a slice of strings using fmt.Sprint. Use StringifySlice for options for stringifying.\n\n```go\nfunc StringSliceToInterfaceSlice(values []string) []interface{}\n```\nStringSliceToInterfaceSlice converts a slice of strings to a slice of interface{}.\n\n```go\nfunc StringifyMapKeys(in interface{}, stringer Stringer) (interface{}, error)\n```\nStringifyMapKeys recursively stringifying map keys from interface{} to string. This functionality is inspired by work done in [https://github.com/gohugoio/hugo](https://github.com/gohugoio/hugo), but support many more types, including:\n\n  - \\[]interface{}\n  - \\[]\\[]interface{}\n  - \\[]map\\[interface{}]interface{}\n  - map\\[interface{}]interface{}\n  - map\\[string]interface{}\n  - map\\[string]\\[]interface{}\n  - map\\[string]map\\[string]\\[]interface{}\n  - map\\[interface{}]struct{}\n\nSee [https://github.com/gohugoio/hugo/pull/4138](https://github.com/gohugoio/hugo/pull/4138) for background.\n\n```go\nfunc StringifySlice(in interface{}, stringer Stringer) ([]string, error)\n```\nStringifySlice converts all the objects in a slice or array to strings using the given stringer. Returns a \\[]string, and error if any.\n\n## Types\n\n```go\ntype Stringer func(object interface{}) (string, error)\n```\nStringer is a type alias for a function that converts an object into a string and returns an error if any.\n\n```go\nfunc NewDecimalStringer() Stringer\n```\nNewDecimalStringer returns a new stringer that uses decimal notation.\n\n```go\nfunc NewDefaultStringer() Stringer\n```\nNewDefaultStringer returns a new default stringer.\n\n```go\nfunc NewStringer(noDataValue string, decimal bool, lower bool, upper bool) Stringer\n```\nNewStringer creates a new Stringer. If decimal is true, the stringer converts floats to strings in decimal notation rather than scientific notation. If lower, then returned strings are converted to lower case. If upper, then returned strings are converted to upper case.\n\n","path":"github.com/spatialcurrent/go-stringify/pkg/stringify","name":"stringify","synopsis":"Package stringify is a simple library for generating a stringer that converts literals to strings, converts map keys to strings, or converts a slice to a slice of strings.","isRedistributable":true}
