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 CompareStringsCaseInsensitive(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(dir string) bool
- func EscapeJSON(jsonString string) string
- 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 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 ReverseStringSlice(slice []string)
- func Round(val float64, prec int) float64
- func SetSliceLengh(slice reflect.Value, length int) reflect.Value
- func Sort(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 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 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) 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) ForceCloseTag() *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 AddUrlParam ¶
func CombineDirs ¶
func ConvertTimeString ¶
func DeleteEmptySliceElements ¶
func DeleteEmptySliceElements(slice interface{}) interface{}
func EscapeJSON ¶
func FileExists ¶
func FileModifiedTime ¶
func FindFile2ModifiedTime ¶
func HasImageFileExt ¶
func IsImageURL ¶
func JoinNonEmptyStrings ¶
func NewLineToHTML ¶
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 StringForStruct ¶
Todo something more generic
func StringSliceUnion ¶
func StripHTMLTags ¶
func TextRowsAndCols ¶
func TimeInRange ¶
Types ¶
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 XMLWriter ¶
type XMLWriter struct {
// contains filtered or unexported fields
}
func NewXMLWriter ¶
func (*XMLWriter) AttribIfNotDefault ¶
func (*XMLWriter) EscapeContent ¶
func (*XMLWriter) ForceCloseTag ¶
Creates an explicit close tag, even if there is no content
func (*XMLWriter) PrintfEscape ¶
Click to show internal directories.
Click to hide internal directories.