format

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Formatter

func Formatter(x interface{}) (f fmt.Formatter)

Реализация fmt.Formatter interface. fmt.Sprintf("%# v", Formatter(x))

func Indent

func Indent(s, prefix string) string

Indent вставляет prefix в начале каждой непустой строки s.

func IndentBytes

func IndentBytes(b, prefix []byte) []byte

IndentBytes вставляет prefix в начале каждой непустого среза b.

func NewIndentWriter

func NewIndentWriter(w io.Writer, pre ...[]byte) io.Writer

NewIndentWriter задает для io.Writer префикс pre для каждой новой строки.

Types

type SortedMap

type SortedMap struct {
	Key   []reflect.Value
	Value []reflect.Value
}

SortedMap организует отсортированный хеш Key=>Value для структур reflect.Value. Ключи и значения выровнены в порядке индекса: Value[i] соответствует Key[i].

func Sort

func Sort(mapValue reflect.Value) *SortedMap

Sort принимает reflect.Map и возвращмет структуру SortedMap, с сортировкой по ключу. Это позволяте устранить проблемы когда ключ имеет значение NaN.

func (*SortedMap) Len

func (o *SortedMap) Len() int

func (*SortedMap) Less

func (o *SortedMap) Less(i, j int) bool

func (*SortedMap) Swap

func (o *SortedMap) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL