Documentation ¶
Overview ¶
Helpers, convenience functions and stuff missing in the standard packages.
Index ¶
- Constants
- func AddUrlParam(url, name, value string) string
- func AppendEmptySliceField(slice reflect.Value) reflect.Value
- func CombineDirs(baseDirs []string, searchDirs []string) []string
- func CompareCaseInsensitive(a, b string) bool
- func ConvertTimeString(value, formatIn, formatOut string) (result string, err error)
- 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(dirname string) bool
- func EscapeJSON(jsonString string) string
- func FileExists(filename string) bool
- func FileModifiedTime(filename string) (time.Time, 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 time.Time)
- func HasImageFileExt(filename string) bool
- func IntRange(start int, end int) <-chan int
- func IntRangeStep(start int, end int, step int) <-chan int
- func IsImageURL(url string) bool
- func JoinAbs(elem ...string) (string, error)
- func JoinNonEmptyStrings(sep string, strings ...string) string
- func MD5(data string) string
- func NewLineToHTML(text string) (html string)
- func OwnIP() string
- func PrettifyJSON(compactJSON []byte) string
- func ReadURL(url string) ([]byte, error)
- func RemoveMultipleWhiteSpace(s string) string
- func ReverseStringSlice(slice []string)
- func Round(val float64, prec int) float64
- func SetSliceLengh(slice reflect.Value, length int) reflect.Value
- func SortInterfaceSlice(slice []interface{}, lessFunc func(a, b interface{}) bool)
- func StringForStruct(typeName string, attributes ...string) string
- func StringIn(needle string, heystack []string) bool
- func StringSliceUnion(a, b []string) []string
- func StripHTMLTags(text string) (plainText string)
- func TextRowsAndCols(text string) (rows, cols int)
- func TimeInRange(t, from, until time.Time) bool
- type IntSet
- type SortableInterfaceSlice
- 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 StringSet
- 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 XMLWriter
- func (self *XMLWriter) Attrib(name string, value ...interface{}) *XMLWriter
- func (self *XMLWriter) AttribFlag(name string, flag bool) *XMLWriter
- func (self *XMLWriter) AttribIfNotDefault(name string, value interface{}) *XMLWriter
- func (self *XMLWriter) CloseTag() *XMLWriter
- func (self *XMLWriter) CloseTagAlways() *XMLWriter
- func (self *XMLWriter) Content(s string) *XMLWriter
- func (self *XMLWriter) EscapeContent(s string) *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)
- func (self *XMLWriter) WriteXMLDeclaration() *XMLWriter
Constants ¶
View Source
const LoopbackIP = "127.0.0.1"
Variables ¶
This section is empty.
Functions ¶
func AddUrlParam ¶
func CombineDirs ¶
func CompareCaseInsensitive ¶
func ConvertTimeString ¶
func DeleteEmptySliceElements ¶
func DeleteEmptySliceElements(slice interface{}) interface{}
func EscapeJSON ¶
func FileExists ¶
func FindFile2ModifiedTime ¶
func HasImageFileExt ¶
func IsImageURL ¶
func JoinNonEmptyStrings ¶
func NewLineToHTML ¶
func OwnIP ¶
func OwnIP() string
OwnIP returns the primary IP address of the system or an empty string.
func PrettifyJSON ¶
func ReverseStringSlice ¶
func ReverseStringSlice(slice []string)
func SetSliceLengh ¶
Sets the length of a slice by sub-slicing a slice that's too long, or appending empty fields if slice is too short.
func SortInterfaceSlice ¶
func SortInterfaceSlice(slice []interface{}, lessFunc func(a, b interface{}) bool)
func StringForStruct ¶
Todo something more generic
func StringSliceUnion ¶
func StripHTMLTags ¶
func TextRowsAndCols ¶
func TimeInRange ¶
Types ¶
type SortableInterfaceSlice ¶
type SortableInterfaceSlice struct { Slice []interface{} LessFunc func(a, b interface{}) bool }
Implements sort.Interface
func (*SortableInterfaceSlice) Len ¶
func (self *SortableInterfaceSlice) Len() int
func (*SortableInterfaceSlice) Less ¶
func (self *SortableInterfaceSlice) Less(i, j int) bool
func (*SortableInterfaceSlice) Sort ¶
func (self *SortableInterfaceSlice) Sort()
func (*SortableInterfaceSlice) Swap ¶
func (self *SortableInterfaceSlice) Swap(i, j int)
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 XMLWriter ¶
type XMLWriter struct {
// contains filtered or unexported fields
}
func NewXMLWriter ¶
func (*XMLWriter) AttribFlag ¶
AttribFlag writes a name="name" attribute if flag is true, else nothing will be written.
func (*XMLWriter) AttribIfNotDefault ¶
func (*XMLWriter) CloseTagAlways ¶
Creates an explicit close tag, even if there is no content
func (*XMLWriter) EscapeContent ¶
func (*XMLWriter) PrintfEscape ¶
func (*XMLWriter) WriteXMLDeclaration ¶
Click to show internal directories.
Click to hide internal directories.