Documentation
¶
Index ¶
- func CalcSettlementDate(today time.Time, bankHolidayMap map[string]bool) time.Time
- func Check(e error)
- func Float64Equal(a, b float64) bool
- func GenRandomString(strlen int) string
- func GetLocalIP() (ip string, err error)
- func MakeFileName(fileExtension string, directory string) string
- func Padding(s string, length int, justified string, padChar string) (string, error)
- func RoundDuration(d, r time.Duration) time.Duration
- func RoundFloat64(val float64, places int) float64
- func SliceIndex(limit int, predicate func(i int) bool) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalcSettlementDate ¶
CalcSettlementDate takes in today's date (basically "now") along with a a map of bank holidays and it calculates to correct settlement date for ACH transactions.
func Check ¶
func Check(e error)
Check streamlines error checks - use it *only* when the program should halt
func Float64Equal ¶
Float64Equal checks not whether the numbers are exactly the same, but whether their difference is very small. The error margin that the difference is compared to is called epsilon.
func GenRandomString ¶
GenRandomString returns a hexadecimal random string
func GetLocalIP ¶
GetLocalIP returns the non-loopback local IP of the host
func MakeFileName ¶
MakeFileName creates a new filename
func Padding ¶
Padding takes a string, length and either "left" or "right" for padding/justification plus a padding character. It will pad the string out.
func RoundDuration ¶
RoundDuration rounds time.Duration Example to seconds: RoundDuration(d, time.Second)
func SliceIndex ¶
SliceIndex figures out the index of slice given a value in the slice. http://stackoverflow.com/questions/8307478/go-how-to-find-out-element-position-in-slice It's used to find the slice position of the process activity step. Then we use that to calculate the next action. Usage: xs := []int{2, 4, 6, 8} ys := []string{"C", "B", "K", "A"} fmt.Println(
SliceIndex(len(xs), func(i int) bool { return xs[i] == 5 }),
SliceIndex(len(xs), func(i int) bool { return xs[i] == 6 }),
SliceIndex(len(ys), func(i int) bool { return ys[i] == "Z" }),
SliceIndex(len(ys), func(i int) bool { return ys[i] == "A" }))
Types ¶
This section is empty.