Documentation ¶
Overview ¶
Helpers, convenience functions and stuff missing in the standard packages.
Index ¶
- Constants
- func CallMethod(object interface{}, method string, args ...interface{}) (results []interface{}, err error)
- func CallMethod1(object interface{}, method string, args ...interface{}) (result interface{}, err error)
- func CombineDirs(baseDirs []string, searchDirs []string) []string
- func CompareStringsCaseInsensitive(a, b string) bool
- func ConvertTimeString(value, formatIn, formatOut string) (result string, err error)
- func CopyExportedStructFields(src, dst interface{}) (copied int)
- func DayBeginningTime(someTimeOfTheDay time.Time) time.Time
- func DayTimeRange(someTimeOfTheDay time.Time) (from, until time.Time)
- func DeleteEmptySliceElements(slice interface{}) interface{}
- func DeleteEmptySliceElementsVal(sliceVal reflect.Value) reflect.Value
- func DirExists(dir string) bool
- func EscapeJSON(jsonString string) string
- func ExportedStructFields(s interface{}) map[string]interface{}
- func FileExists(dir string) bool
- func FileModifiedTime(filename string) (time int64, err error)
- func FindFile(searchDirs []string, filename string) (filePath string, found bool)
- func FindFile2(baseDirs []string, searchDirs []string, filename string) (filePath string, found bool)
- func FindFile2ModifiedTime(baseDirs []string, searchDirs []string, filename string) (filePath string, found bool, modifiedTime int64)
- func FindFlattenedStructField(t reflect.Type, matchFunc MatchStructFieldFunc) *reflect.StructField
- func HasImageFileExt(filename string) bool
- func IntRange(start int, end int) <-chan int
- func IntRangeStep(start int, end int, step int) <-chan int
- func IsDeepNil(i interface{}) bool
- func IsDefaultValue(value interface{}) bool
- func IsExportedName(name string) bool
- func IsImageURL(url string) bool
- func JoinAbs(elem ...string) (string, error)
- func JoinNonEmptyStrings(sep string, strings ...string) string
- func MD5(data string) string
- func NewInstance(prototype interface{}) interface{}
- func NewLineToHTML(text string) (html string)
- func OwnIP() string
- func PrettifyJSON(compactJSON []byte) string
- func ReadBytesFrom(reader io.Reader) ([]byte, error)
- func ReadStringFrom(reader io.Reader) (string, error)
- func ReverseStringSlice(slice []string)
- func SliceDelete(slice []interface{}, index int, count int) (result []interface{})
- func SliceInsert(slice []interface{}, index int, count int, value interface{}) (result []interface{})
- func Sort(slice []interface{}, lessFunc func(a, b interface{}) bool)
- func StringEndsWith(s string, start string) bool
- func StringForStruct(typeName string, attributes ...string) string
- func StringIn(needle string, heystack []string) bool
- func StringStartsWith(s string, start string) bool
- func StripHTMLTags(text string) (plainText string)
- func TextRowsAndCols(text string) (rows, cols int)
- func TimeInRange(t, from, until time.Time) bool
- type MatchStructFieldFunc
- type Sortable
- type SortableTimeSlice
- type StringBuilder
- func (self *StringBuilder) Bool(value bool) *StringBuilder
- func (self *StringBuilder) Byte(value byte) *StringBuilder
- func (self *StringBuilder) Bytes() []byte
- func (self *StringBuilder) Float(value float64) *StringBuilder
- func (self *StringBuilder) Int(value int) *StringBuilder
- func (self *StringBuilder) Printf(format string, args ...interface{}) *StringBuilder
- func (self *StringBuilder) String() string
- func (self *StringBuilder) Uint(value uint) *StringBuilder
- func (self *StringBuilder) Write(strings ...string) *StringBuilder
- func (self *StringBuilder) WriteBytes(bytes []byte) *StringBuilder
- func (self *StringBuilder) WriteTo(writer io.Writer) (n int64, err error)
- type StringWriter
- func (self *StringWriter) Bool(value bool) *StringWriter
- func (self *StringWriter) Byte(value byte) *StringWriter
- func (self *StringWriter) Float(value float64) *StringWriter
- func (self *StringWriter) Int(value int) *StringWriter
- func (self *StringWriter) Printf(format string, args ...interface{}) *StringWriter
- func (self *StringWriter) Uint(value uint) *StringWriter
- func (self *StringWriter) Write(strings ...string) *StringWriter
- func (self *StringWriter) WriteBytes(bytes []byte) *StringWriter
- type VersionTuple
- type XMLBuffer
- type XMLWriter
- func (self *XMLWriter) Attrib(name string, value ...interface{}) *XMLWriter
- func (self *XMLWriter) AttribIfNotDefault(name string, value interface{}) *XMLWriter
- func (self *XMLWriter) CloseTag() *XMLWriter
- func (self *XMLWriter) Content(s string) *XMLWriter
- func (self *XMLWriter) EscapeContent(s string) *XMLWriter
- func (self *XMLWriter) ExtraCloseTag() *XMLWriter
- func (self *XMLWriter) OpenTag(tag string) *XMLWriter
- func (self *XMLWriter) Printf(format string, args ...interface{}) *XMLWriter
- func (self *XMLWriter) PrintfEscape(format string, args ...interface{}) *XMLWriter
- func (self *XMLWriter) Reset()
- func (self *XMLWriter) Write(p []byte) (n int, err error)
Constants ¶
View Source
const LoopbackIP = "127.0.0.1"
Variables ¶
This section is empty.
Functions ¶
func CallMethod ¶
func CallMethod1 ¶
func CombineDirs ¶
func ConvertTimeString ¶
func CopyExportedStructFields ¶
func CopyExportedStructFields(src, dst interface{}) (copied int)
func DeleteEmptySliceElements ¶
func DeleteEmptySliceElements(slice interface{}) interface{}
func EscapeJSON ¶
func ExportedStructFields ¶
func ExportedStructFields(s interface{}) map[string]interface{}
func FileExists ¶
func FileModifiedTime ¶
func FindFile2ModifiedTime ¶
func FindFlattenedStructField ¶
func FindFlattenedStructField(t reflect.Type, matchFunc MatchStructFieldFunc) *reflect.StructField
func HasImageFileExt ¶
func IsDeepNil ¶
func IsDeepNil(i interface{}) bool
Non nil interfaces can wrap nil values. Comparing the interface to nil, won't return if the wrapped value is nil.
func IsDefaultValue ¶
func IsDefaultValue(value interface{}) bool
func IsExportedName ¶
func IsImageURL ¶
func JoinNonEmptyStrings ¶
func NewInstance ¶
func NewInstance(prototype interface{}) interface{}
Creates a new zero valued instance of prototype
func NewLineToHTML ¶
func PrettifyJSON ¶
func ReverseStringSlice ¶
func ReverseStringSlice(slice []string)
func SliceDelete ¶
func SliceInsert ¶
func StringEndsWith ¶
func StringForStruct ¶
Todo something more generic
func StringStartsWith ¶
func StripHTMLTags ¶
func TextRowsAndCols ¶
func TimeInRange ¶
Types ¶
type MatchStructFieldFunc ¶
type MatchStructFieldFunc func(field *reflect.StructField) bool
type Sortable ¶
type Sortable struct { Slice []interface{} LessFunc func(a, b interface{}) bool }
Implements sort.Interface
type SortableTimeSlice ¶
func (SortableTimeSlice) Len ¶
func (self SortableTimeSlice) Len() int
Len is the number of elements in the collection.
func (SortableTimeSlice) Less ¶
func (self SortableTimeSlice) Less(i, j int) bool
Less returns whether the element with index i should sort before the element with index j.
func (SortableTimeSlice) Swap ¶
func (self SortableTimeSlice) Swap(i, j int)
Swap swaps the elements with indexes i and j.
type StringBuilder ¶
type StringBuilder struct {
// contains filtered or unexported fields
}
func (*StringBuilder) Bool ¶
func (self *StringBuilder) Bool(value bool) *StringBuilder
func (*StringBuilder) Byte ¶
func (self *StringBuilder) Byte(value byte) *StringBuilder
func (*StringBuilder) Bytes ¶
func (self *StringBuilder) Bytes() []byte
func (*StringBuilder) Float ¶
func (self *StringBuilder) Float(value float64) *StringBuilder
func (*StringBuilder) Int ¶
func (self *StringBuilder) Int(value int) *StringBuilder
func (*StringBuilder) Printf ¶
func (self *StringBuilder) Printf(format string, args ...interface{}) *StringBuilder
func (*StringBuilder) String ¶
func (self *StringBuilder) String() string
func (*StringBuilder) Uint ¶
func (self *StringBuilder) Uint(value uint) *StringBuilder
func (*StringBuilder) Write ¶
func (self *StringBuilder) Write(strings ...string) *StringBuilder
func (*StringBuilder) WriteBytes ¶
func (self *StringBuilder) WriteBytes(bytes []byte) *StringBuilder
type StringWriter ¶
type StringWriter struct {
// contains filtered or unexported fields
}
func (*StringWriter) Bool ¶
func (self *StringWriter) Bool(value bool) *StringWriter
func (*StringWriter) Byte ¶
func (self *StringWriter) Byte(value byte) *StringWriter
func (*StringWriter) Float ¶
func (self *StringWriter) Float(value float64) *StringWriter
func (*StringWriter) Int ¶
func (self *StringWriter) Int(value int) *StringWriter
func (*StringWriter) Printf ¶
func (self *StringWriter) Printf(format string, args ...interface{}) *StringWriter
func (*StringWriter) Uint ¶
func (self *StringWriter) Uint(value uint) *StringWriter
func (*StringWriter) Write ¶
func (self *StringWriter) Write(strings ...string) *StringWriter
func (*StringWriter) WriteBytes ¶
func (self *StringWriter) WriteBytes(bytes []byte) *StringWriter
type VersionTuple ¶
type VersionTuple []int
func MakeVersionTuple ¶
func MakeVersionTuple(fields ...int) VersionTuple
func ParseVersionTuple ¶
func ParseVersionTuple(s string) (VersionTuple, error)
func (VersionTuple) GreaterEqual ¶
func (self VersionTuple) GreaterEqual(other VersionTuple) bool
func (VersionTuple) String ¶
func (self VersionTuple) String() string
type XMLBuffer ¶
type XMLBuffer struct { XMLWriter // contains filtered or unexported fields }
func NewXMLBuffer ¶
func NewXMLBuffer() *XMLBuffer
type XMLWriter ¶
type XMLWriter struct {
// contains filtered or unexported fields
}
func NewXMLWriter ¶
func (*XMLWriter) AttribIfNotDefault ¶
func (*XMLWriter) EscapeContent ¶
func (*XMLWriter) ExtraCloseTag ¶
Creates an explicit close tag, even if there is no content
func (*XMLWriter) PrintfEscape ¶
Click to show internal directories.
Click to hide internal directories.