Documentation ¶
Overview ¶
Package ats (= any to string) provides functions to Get a string from 'anything' (= interface{})
ats observes different conventions of 'things' (=objects) to do so:
stringer: String() - fmt.Stringer & friends string: string - builtin type namer: Name() - filepath.File & .FileInfo, text/template.Template ... geter: Get() - do/Value ider: Id() - ...
The different Get-functions just use a different sequence of attempts to obtain a meaningful string from interface{}, and return the best/first, or -as a last resort- a constant string such as "<not a Xyz>"
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetGet ¶
func GetGet(any interface{}) string
GetGet - order: Get, String, string, Name, Id, "<not a Get>"
func GetId ¶
func GetId(any interface{}) string
GetId - order: Id, Name, Get, String, string, "<not an Id>"
Types ¶
type Friendly ¶
type Friendly interface { GetString() string // fmt.Stringer & friends GetName() string // filepath.File & .FileInfo, text/template.Template ... GetGet() string // do/Value GetId() string // ... }
Friendly - my interface - exposed for godoc - only ;-)
I love to be friendly - thus: I observe different popular API's to convert anything to a meaningful text string