Documentation
¶
Index ¶
- func Any2Date(inVal any) (*time.Time, error)
- func Any2Float32(inVal any) (*float32, error)
- func Any2Float64(inVal any) (*float64, error)
- func Any2Int(inVal any) (*int, error)
- func Any2Int32(inVal any) (*int32, error)
- func Any2Int64(inVal any) (*int64, error)
- func Any2Kind(inVal any, kind reflect.Kind) (any, error)
- func Any2String(inVal any) string
- func AnySlice2Float64(inVal []any) ([]float64, error)
- func BuildQuery(srcQry string, replacers keyval.KeyVal) (qry string)
- func Comparer(xa, xb any, comp string) (truth bool, err error)
- func CopyFile(sourceFile, destFile string) error
- func CopyFiles(fromDir, toDir string) error
- func DBExists(db string, conn *chutils.Connect) error
- func DropTable(table string, conn *chutils.Connect) error
- func Fig2File(fig *grob.Fig, outDir, outFile string) error
- func FileExists(file string) error
- func GTAny(xa, xb any) (truth bool, err error)
- func Has(needle, delim string, haystack ...string) bool
- func LTAny(x, y any) (bool, error)
- func MaxInt(ints ...int) int
- func MinInt(ints ...int) int
- func Position(needle, delim string, haystack ...string) int
- func PrettyDur(startTime time.Time) string
- func RandNorm(n int) ([]float64, error)
- func RandUnifFlt(n int) ([]float64, error)
- func RandUnifInt(n, upper int) ([]int64, error)
- func RandomLetters(length int) string
- func ReplaceSmart(source, oldChar, newChar, delim string) string
- func Slash(inStr string) string
- func String2Kind(str string) reflect.Kind
- func TableExists(table string, conn *chutils.Connect) error
- func TableOrQuery(table string) string
- func TempFile(ext string, length int) string
- func TempTable(tmpDB string, length int) string
- func ToFile(fileName, text string) error
- func ToLastDay(dt time.Time) (eom time.Time)
- func YesNo(inStr string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Any2Date ¶ added in v0.0.9
Any2Date attempts to convert inVal to a date (time.Time). Returns nil if this fails.
func Any2Float32 ¶ added in v0.0.9
Any2Float32 attempts to convert inVal to float32. Returns nil if this fails.
func Any2Float64 ¶ added in v0.0.9
Any2Float64 attempts to convert inVal to float64. Returns nil if this fails.
func Any2Int32 ¶ added in v0.0.9
Any2Int32 attempts to convert inVal to int32. Returns nil if this fails.
func Any2Int64 ¶ added in v0.0.9
Any2Int64 attempts to convert inVal to int64. Returns nil if this fails.
func Any2String ¶ added in v0.0.9
func AnySlice2Float64 ¶ added in v0.0.12
func BuildQuery ¶
BuildQuery replaces the placeholders with values placeholders have the form "?key". BuildQuery prepends a "?" to the keys in replacers.
func Comparer ¶ added in v0.0.9
Comparer compares xa and xb. Comparisons available are: ==, !=, >, <, >=, <=
func Fig2File ¶ added in v0.1.16
Fig2File outputs a plotly figure to a graphics file (png, jpg, etc) This package requires that orca be installed. The orca repo is [here](https://github.com/plotly/orca).
Steps:
Download the latest [release](https://github.com/plotly/orca/releases) of the AppImage.
Put it somewhere safe.
chmod +x
make a symbolic link called "orca" in your path.
orca requires FUSE. FUSE installation instructions are [here](https://github.com/AppImage/AppImageKit/wiki/FUSE)
Note that --no-sandbox is added to orca per this [thread](https://github.com/chrismaltby/gb-studio/issues/1102).
func FileExists ¶
FileExists returns an error if "file" does not exist.
func Position ¶
Position returns the index of needle in the haystack. It returns -1 if needle is not found. If haystack has length 1, then it is split into a slice with delimiter ",".
func RandUnifFlt ¶ added in v0.0.6
RandUnifFlt generates a slice whose elements are random U(0, 1) floats
func RandUnifInt ¶ added in v0.0.6
RandUnifInt generates a slice whose elements are random U[0,upper) int64's
func RandomLetters ¶ added in v0.0.7
RandomLetters generates a string of length "length" by randomly choosing from a-z
func ReplaceSmart ¶ added in v0.0.12
ReplaceSmart replaces old with new except when it occurs within delim
func String2Kind ¶ added in v0.0.9
String2Kind converts a string specifying a type to the reflect.Kind
func TableExists ¶
TableExists returns an error if "table" does not exist. conn is the DB connector.
func TableOrQuery ¶ added in v0.0.5
TableOrQuery takes table and returns a query. If it is already a query (has "select"), just returns the original value.
func TempFile ¶
TempFile produces a random temp file name in the system's tmp location. The file has extension "ext". The file name begins with "tmp" has length 3 + length.
func TempTable ¶
TempTable produces a random table name. The table name begins with "tmp". The table's name has length 3 +length. tmpDB is the database name.
Types ¶
This section is empty.