templatestrings

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: MIT Imports: 19 Imported by: 6

README

templatestrings

license

A set of functions that extend string operations for Go (golang) templates

Note: this is an initial chekckin and I am working on the documentation and tests for this.

Documentation

Index

Constants

View Source
const ISO8601 = "2006-01-02T15:04:05.99999Z07:00"
View Source
const (
	PathSep = string(os.PathSeparator)
)

Variables

This section is empty.

Functions

func CenterStr

func CenterStr(n int, t interface{}) (r string)

Center the string 's' in the width 'n'

func Concat

func Concat(args ...interface{}) string

func DoGet

func DoGet(client *http.Client, url string) string

===================================================================================================================================================

func DoPost

func DoPost(client *http.Client, Url string, s string) string

===================================================================================================================================================

func ExtendData

func ExtendData(a map[string]interface{}, b map[string]interface{}) (rv map[string]interface{})

func FindCol

func FindCol(aName string, nameArray []string) int

Implement Dijkstra's L algorythm on an array of strings. Return -1 if not found, else index of item.

func FixBindParams

func FixBindParams(qry string, data ...interface{}) (qryFixed string, retData []interface{}, err error)

func FmtDate

func FmtDate(f string, t time.Time) (r string)

func FmtPrintfStr

func FmtPrintfStr(f string, s interface{}) (r string)

func FuzzyDateTimeParse

func FuzzyDateTimeParse(s string, nullOk bool) (d time.Time, isNull bool, err error)

func GenTmpFileName

func GenTmpFileName(dir, prefix string, fx func(fn string)) func() string

===================================================================================================================================================

func HomeDir

func HomeDir() string

func IfDef

func IfDef(dataHash map[string]interface{}, it string, ss ...string) string

=================================================================================================================================================== New Mon Feb 23 16:37:31 MST 2015 =================================================================================================================================================== {{ifDef . "Placeholder" "placeholder=\"" "$$" "\""}}

func IfIsDef

func IfIsDef(dataHash map[string]interface{}, it string) bool

func IfIsNotNull

func IfIsNotNull(dataHash map[string]interface{}, it string) bool

func IntersectData

func IntersectData(a map[string]interface{}, b map[string]interface{}) (rv map[string]interface{})

Keep the data that has common keys between 'a' and 'b', prefering data from 'b' not used at the moment.

func LeftData

func LeftData(a map[string]interface{}, b map[string]interface{}) (rv map[string]interface{})

Copy 'a', if same key in 'b', then copy data from b, prefering data from 'b'

func LowerCaseNames

func LowerCaseNames(a map[string]interface{}) (rv map[string]interface{})

func Nvl

func Nvl(show string, d string) string

func PadOnLeft

func PadOnLeft(n int, s interface{}) (r string)

func PadOnRight

func PadOnRight(n int, s interface{}) (r string)

func PadStr

func PadStr(l int, w string, s string) string

Pad a string with 'w' to a length of 'l' - pad on left

func PadStrRight

func PadStrRight(l int, w string, s string) string

Pad a string with 'w' to a length of 'l' - pad on right

func PicFloat

func PicFloat(format string, flt interface{}) (r string)

func PicTime

func PicTime(f string, t interface{}) (r string)

idiotic format for dates ( just use ISO format YYYY-MM-DDTHH:mm:ss.nnn! )

   <field member="Arrival" columns="40">Arrived   : {0:hh:mm tt  ddd, MMM dd, yyyy}</field>
		hh - 2digit hours
		mm - 2digit minutes
		tt - lower case am/pm
		ddd - day of week
		MMM - 3 char month name abrev.
		dd - 2 digit day of month.
		yyyy - year 4 digit

func SplitOnWords

func SplitOnWords(s string) (record []string)

func StrFTime

func StrFTime(f string, t time.Time) (r string)

func ToJSON

func ToJSON(arg interface{}) string

=================================================================================================================================================== JSON Fri Sep 22 09:23:39 MDT 2017

func ToJSONFormated

func ToJSONFormated(arg interface{}) string

func ZeroPad

func ZeroPad(l int, s string) string

func ZeroPadRight

func ZeroPadRight(l int, s string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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