Documentation ¶
Index ¶
- func BoxIt(str []string, width int) string
- func ByteToString(input []byte, length int) string
- func ProgramElapsedTime() float64
- func RPCID() int64
- func RequestID() int64
- func Round(num float64) int
- func SetPrecision(num float64, precision int) float64
- func TimeoutChan(t time.Duration) chan bool
- func ValidateLatLng(lat, lng float64) bool
- type Address
- type Conversion
- type LogString
- func (l *LogString) AddF(format string, args ...interface{})
- func (l *LogString) AddS(s string)
- func (l *LogString) AddSR(s string)
- func (l *LogString) Box(w int) string
- func (l *LogString) BoxC(w int) string
- func (l *LogString) Color(s, color string) string
- func (l *LogString) ColorBool(v bool, strue, sfalse, ctrue, cfalse string) string
- type SerialID
- type UnixTimestampType
- type Validation
- type ValidationDetail
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteToString ¶
ByteToString converts a byte array to a string.
func ProgramElapsedTime ¶
func ProgramElapsedTime() float64
ProgramElapsedTime returns the time elapsed since the program started.
func SetPrecision ¶
SetPrecision effectively rounds a floating point number to the specified precision.
func TimeoutChan ¶
TimeoutChan returns a "chan bool" that will receive a "true" value after the specifed dur`ation t.
func ValidateLatLng ¶
ValidateLatLng validates a lat/lng pair against the Continental US boundaries.
Types ¶
type Address ¶
type Address struct { Addr string City string State string Zip string Lat, Long float64 Valid bool }
Address represents a standard US street address.
func AddrForLatLng ¶
AddrForLatLng finds the nearest address to the coordinates.
func NewAddrP ¶
NewAddrP returns a new address struct from the address, city, state, and option zipcode.
func ParseAddress ¶
ParseAddress accepts a comma delimited address string, and returns the address, city, state and zip. NOTE: this function does very little error checking.
func (*Address) FullAddr ¶
FullAddr returns the standard comma delimited full addres string, like: "{{addr}}, {{city}}, {{state}} {{zip}}"
type Conversion ¶
type Conversion struct {
Validation
}
Conversion represents a Conversion. It is composed of a Validation.
func NewConversion ¶
func NewConversion() Conversion
NewConversion returns a conversion set. A Conversion set will log all errors captured during one or more conversions. All possible conversions are specifed below in init().
func (*Conversion) Bool ¶
func (r *Conversion) Bool(name, val string) bool
Bool validates a boolean target as per the vparms for the specified name.
func (*Conversion) Float ¶
func (r *Conversion) Float(name, val string) float64
Float validates a float target as per the vparms for the specified name.
func (*Conversion) Int ¶
func (r *Conversion) Int(name, val string) int
Int validates a integer target as per the vparms for the specified name.
func (Conversion) String ¶
func (r Conversion) String() string
type LogString ¶
type LogString struct {
// contains filtered or unexported fields
}
LogString is used to "box" object representations.
func NewLogString ¶
func NewLogString() *LogString
NewLogString creates a new LogString, and initializes color printing.
func (*LogString) Box ¶
Box draws a box around the LogString with the specified line width, with a leading line return.
func (*LogString) BoxC ¶
BoxC draws a box around the LogString with the specified line width, without a leading line return.
type UnixTimestampType ¶
type UnixTimestampType int64
UnixTimestampType reqresents a Unix timestamp.
func (*UnixTimestampType) SetCurrentTime ¶
func (r *UnixTimestampType) SetCurrentTime()
SetCurrentTime sets the UnixTimestampType variable to the current time.
func (UnixTimestampType) String ¶
func (r UnixTimestampType) String() string
String returns a string represenation of a UnixTimestampType custom type.
type Validation ¶
type Validation map[string]*ValidationDetail
Validation is a simple method for compiling validation results.
func (Validation) Error ¶
func (r Validation) Error() string
Error is a standard error interface, returning a string listing any failed validations.
func (Validation) IsOK ¶
func (r Validation) IsOK(item string) bool
IsOK returns the state of the requested Validation. If the Validation has not been set, it will return FALSE.
func (Validation) Ok ¶
func (r Validation) Ok() bool
Ok scans all validations - if all are true (i.e. they passed that validation test), then it returns true.
func (Validation) Set ¶
func (r Validation) Set(item, result string, isOK bool)
Set creates a validation as ok (true) or not (false).
func (Validation) String ¶
func (r Validation) String() string
String returns a string representation of the validation entries.
type ValidationDetail ¶
type ValidationDetail struct {
// contains filtered or unexported fields
}
ValidationDetail is a simple method for compiling validation results.