Documentation ¶
Index ¶
- func FilterByFieldName(names ...string) func(obj reflect.Value, fieldIdx int) (hitFilter bool)
- func Fmt(s string, indentSpacesCount uint8) (string, error)
- func NotExportFieldFilter(obj reflect.Value, fieldIdx int) (hitFilter bool)
- func ProtobufFieldFilter(obj reflect.Value, fieldIdx int) (hitFilter bool)
- func String(obj interface{}) string
- func StringByConf(obj interface{}, conf Config) (ret string)
- func Stringer(obj interface{}, filterStructField ...string) fmt.Stringer
- func StringerByConf(obj interface{}, conf Config) fmt.Stringer
- func StringerKvs(kvs ...interface{}) fmt.Stringer
- type Config
- func (c Config) AppendFilter(fs ...func(obj reflect.Value, fieldIdx int) (hitFilter bool)) Config
- func (c Config) Clone() Config
- func (c Config) SetFilters(fs ...func(obj reflect.Value, fieldIdx int) (hitFilter bool)) Config
- func (c Config) SetInformationLevel(l InformationLevel) Config
- func (c Config) SetWarnSize(s int) Config
- func (c Config) Stringer(obj interface{}) fmt.Stringer
- func (c Config) StringerKvs(kvs ...interface{}) fmt.Stringer
- type InformationLevel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterByFieldName ¶ added in v1.0.3
func Fmt ¶
返回tostr.String生成的字符串格式化之后的结果, indentSpacesCount指定缩进使用的空格数. 例如: s为:"{slice:[1, 2, 3], m:{1:"string", 2:"var"}}", indentSpacesCount为4, 则格式化后的结果如下:
{ slice:[ 1, 2, 3 ], m:{ 1:"string", 2:"var" } }
func NotExportFieldFilter ¶ added in v1.0.3
func ProtobufFieldFilter ¶ added in v1.0.3
func StringByConf ¶
func StringerByConf ¶
func StringerKvs ¶ added in v1.0.3
Types ¶
type Config ¶
type Config struct { InformationLevel InformationLevel // 返回true表示过滤掉field对应的结点, 也即不在对field对应的结点递归访问 FilterStructField []func(obj reflect.Value, fieldIdx int) (hitFilter bool) // FastSpecifyToStringProbe(obj)返回true时,使用ToString(obj)作为obj的字符串呈现结果 ToString func(obj reflect.Value) (objStr string) // FastSpecifyToStringProbe(obj)需高效返回obj是否存在指定的String函数,存在时返回true FastSpecifyToStringProbe func(obj reflect.Value) (hasSpecifyToString bool) // 生成字符串的过程中,如果中途字符串的字节数超过WarnSize,则会调用ResultTooLongCallback(str),str表示当前已经生成的字符串,返回true表示继续执行,返回false表示终止执行 ResultSizeWarnCallback func(str string) (shouldContinue bool) // 仅在非nil时表示指定警戒字节数 WarnSize *int DisableMapKeySort bool }
func (Config) AppendFilter ¶ added in v1.0.3
func (Config) SetFilters ¶ added in v1.0.3
func (Config) SetInformationLevel ¶ added in v1.0.3
func (c Config) SetInformationLevel(l InformationLevel) Config
func (Config) SetWarnSize ¶ added in v1.0.3
func (Config) StringerKvs ¶ added in v1.0.3
type InformationLevel ¶
type InformationLevel int32
const ( // 不展示类型信息 NoTypesInfo InformationLevel = iota // 展示除基本类型之外的类型信息 NoBaseKindsInfoOnly // 展示所有的类型信息 AllTypesInfo )
Click to show internal directories.
Click to hide internal directories.