Documentation
¶
Index ¶
- Constants
- Variables
- func CheckTag(tag string) error
- func IndentColorizeStringIn(w io.Writer, str, indent, colOn, colOff string)
- func IndentString(str, indent string) string
- func IndentStringIn(w io.Writer, str, indent string)
- func JSONPointer(v any, pointer string) (any, error)
- func SliceToString(buf *strings.Builder, items []reflect.Value) *strings.Builder
- func TernRune(cond bool, a, b rune) rune
- func TernStr(cond bool, a, b string) string
- func ToString(val any) string
- func TypeFullName(t reflect.Type) string
- type JSONPointerError
Constants ¶
const ( ErrJSONPointerInvalid = "invalid JSON pointer" ErrJSONPointerKeyNotFound = "key not found" ErrJSONPointerArrayNoIndex = "array but not an index in JSON pointer" ErrJSONPointerArrayOutOfRange = "out of array range" ErrJSONPointerArrayBadType = "not a map nor an array" )
Variables ¶
var ErrTagEmpty = errors.New("A tag cannot be empty")
ErrTagEmpty is the error returned by CheckTag for an empty tag.
var ErrTagInvalid = errors.New("Invalid tag, should match (Letter|_)(Letter|_|Number)*")
ErrTagInvalid is the error returned by CheckTag for an invalid tag.
Functions ¶
func IndentColorizeStringIn ¶ added in v1.13.0
IndentColorizeStringIn indents str lines (from 2nd one = 1st line is not indented) by indent and write it to w. Before each end of line, colOff is inserted, and after each indent on new line, colOn is inserted.
func IndentString ¶
IndentString indents str lines (from 2nd one = 1st line is not indented) by indent.
func IndentStringIn ¶ added in v1.2.0
IndentStringIn indents str lines (from 2nd one = 1st line is not indented) by indent and write it to w.
func JSONPointer ¶ added in v1.8.0
JSONPointer returns the value corresponding to JSON pointer pointer in v as RFC 6901 specifies it. To be searched, v has to contains map[string]any or []any values. All other types fail to be searched.
func SliceToString ¶ added in v1.13.0
SliceToString stringifies items slice into buf then returns buf.
func TypeFullName ¶ added in v1.8.0
TypeFullName returns the t type name with packages fully visible instead of the last package part in t.String().
Types ¶
type JSONPointerError ¶ added in v1.8.0
func (*JSONPointerError) Error ¶ added in v1.8.0
func (e *JSONPointerError) Error() string