util

package
v0.0.0-...-b18a026 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CharDot represents character ".".
	CharDot = "."
	// CharDash represents character "-".
	CharDash = "-"
	// CharUnderscore represents character "_".
	CharUnderscore = "_"
)

Variables

This section is empty.

Functions

func ReplaceDelimiter

func ReplaceDelimiter(str, delimeter string) string

ReplaceDelimiter changes delimiter of string to new and also connect camel case with it.

func StringsToSet

func StringsToSet(slice []string) map[string]bool

StringsToSet turns slice into set

func TabExecutor

func TabExecutor(w io.Writer, tmpl *template.Template, data interface{}) error

TabExecutor executes template with tab writter.

func ToDashCase

func ToDashCase(str string) string

ToDashCase transform str into dash case (e.g. log-level).

func ToDotCase

func ToDotCase(str string) string

ToDotCase transform str into dot case (e.g. log.level).

func ToScreamingCase

func ToScreamingCase(str string) string

ToScreamingCase transform str into screaming case (e.g. log.level to LOG_LEVEL).

func UniqueStrings

func UniqueStrings(slice []string) []string

UniqueStrings returns unique slice.

Types

type FlattenMap

type FlattenMap struct {
	// contains filtered or unexported fields
}

FlattenMap implements node.FlattenMap with key's usage record

func NewFlattenMap

func NewFlattenMap() *FlattenMap

NewFlattenMap initialize a flatten map

func (*FlattenMap) ChildrenByPrefix

func (m *FlattenMap) ChildrenByPrefix(prefix string) (keys []string)

ChildrenByPrefix implements node.FlattenMap

func (*FlattenMap) Keys

func (m *FlattenMap) Keys() []string

Keys returns keys in order by when they were set

func (*FlattenMap) Set

func (m *FlattenMap) Set(originalKey, value string)

Set format key to dot-case and set key to value, which also clear key's usage

func (*FlattenMap) UnusedKeys

func (m *FlattenMap) UnusedKeys(escapedKeys []string) (keys []string)

UnusedKeys returns unused keys after they were set

func (*FlattenMap) Value

func (m *FlattenMap) Value(key string) (value string, ok bool)

Value implements node.FlattenMap with recording key's usage

func (*FlattenMap) Values

func (m *FlattenMap) Values() []string

Values returns values in order by when they were set

Jump to

Keyboard shortcuts

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