Documentation
¶
Overview ¶
utils are currently just a wrapper on top of github/segmentio's extremely fast Camelcase and Snakecase functions, with an added PascalCase.
Thank you @tj for switching to Go just before we did! ;)
Index ¶
- func CamelCase(str string) string
- func GetCallStack() (stack []string)
- func GetCallerName(skip int) (callerName string)
- func GetCallerNames(skip int) (typeName, callerName string)
- func InterfaceToReflect(val interface{}) (reflectValue reflect.Value, err error)
- func KebabCase(str string) string
- func PascalCase(str string) string
- func PrintCallStack()
- func Slug(str string) string
- func SnakeCase(str string) string
- func StringInSlice(searchStr string, strs []string) bool
- func UnCase(str string) string
- func Unique(arr interface{}) (unique interface{}, err error)
- func UniqueInts(arr []int) (unique []int)
- func UniqueStrings(arr []string) (unique []string)
- type ProtobufInfo
- type ProtobufTag
- type TagString
- func (tag *TagString) Add(key string, val string)
- func (tag *TagString) AddMulti(keyVals map[string]string)
- func (tag TagString) Get(key string) string
- func (tag *TagString) ProtobufInfo() (pbInfo *ProtobufInfo)
- func (tag *TagString) Remove(key string) (err error)
- func (tag *TagString) RemoveMulti(keys []string) (err error)
- func (tag *TagString) Set(key string, val string) (success bool)
- func (tag *TagString) SetMulti(keyVals map[string]string) (success bool)
- func (tag *TagString) Sort()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCallStack ¶
func GetCallStack() (stack []string)
func GetCallerName ¶
func GetCallerNames ¶
func InterfaceToReflect ¶
InterfaceToReflect helps ensure the reflect value is in an editable state It will check the type and get the correct reference if possible TODO(morphar) Make some tests
func PascalCase ¶
func PrintCallStack ¶
func PrintCallStack()
func StringInSlice ¶
func UniqueInts ¶
func UniqueStrings ¶
Types ¶
type ProtobufInfo ¶
type ProtobufInfo struct { Type string // wire encoding TagNumber int // protocol tag number Optional bool // opt,req,rep for optional, required, or repeated Required bool // opt,req,rep for optional, required, or repeated Repeated bool // opt,req,rep for optional, required, or repeated Name string // name= the original declared name Enum string // enum= the name of the enum type if it is an enum-typed field. Proto3 bool // proto3 if this field is in a proto3 message }
type ProtobufTag ¶
type ProtobufTag string
type TagString ¶
func (*TagString) ProtobufInfo ¶
func (tag *TagString) ProtobufInfo() (pbInfo *ProtobufInfo)
func (*TagString) Remove ¶
Remove removes tags identified by key Returns an error if the key was not understood
func (*TagString) RemoveMulti ¶
RemoveMulti removes all the tags identified by the keys in the keys array Returns an error if one or more keys was not understood
func (*TagString) Set ¶
Set ONLY sets the tag identified by key, if it already exists Returns true if a tag was found and changed