Documentation ¶
Index ¶
- Constants
- Variables
- func Basename(fn string) (bn string)
- func BasenameExt(fn string) (bn string)
- func ConnectToDb(auth string) *sql.DB
- func DbFprint(db bool, fp io.Writer, format string, arg ...interface{})
- func DbPrint(db bool, format string, arg ...interface{})
- func DbValueFromRow(rvdata []map[string]interface{}, row int, col string, def string) (rv string)
- func DbValueIsNull(rvdata []map[string]interface{}, row int, col string) (rv bool)
- func Dirname(fn string) (bn string)
- func DumpVar(v interface{})
- func EscapeDoubleQuote(s string) string
- func EscapeError(err error) string
- func Exists(name string) bool
- func ExistsGetUDate(name string) (bool, os.FileInfo)
- func ExistsIsDir(name string) bool
- func ExtendData(a map[string]interface{}, b map[string]interface{}) (rv map[string]interface{})
- func ExtendDataS(a map[string]string, b map[string]string) (rv map[string]string)
- func ExtendStringMap(a map[string]string, b map[string]string) map[string]string
- func FilesMatchingPattern(dir, pattern string) []string
- func FilterArray(re string, inArr []string) (outArr []string)
- func FindDirsWithSQLCfg(pth string, ignoreDirs []string) (rv []string)
- func FindFiles(pth string, ignoreDirs []string) (rv []string)
- func FnToCSSClass(filename string) string
- func Fopen(fn string, mode string) (file *os.File, err error)
- func GetFile(fn string) string
- func GetFilenames(dir string) (filenames, dirs []string)
- func GetIPFromRemoteAddr(RemoteAddr string) (rv string)
- func GetImageFiles(dir string) []string
- func GetLead() (lead string)
- func HasKeys(v map[string]interface{}) bool
- func HexSha1(s string) string
- func InArray(lookFor string, inArr []string) bool
- func InArrayN(lookFor string, inArr []string) int
- func InsSel(db *sql.DB, sel string, ins string, mdata map[string]string) (id string)
- func InsUpd(db *sql.DB, ins string, upd string, mdata map[string]string)
- func IntersectData(a map[string]interface{}, b map[string]interface{}) (rv map[string]interface{})
- func IsIntString(s string) bool
- func JSONStringToData(s string) (theJSON map[string]interface{}, err error)
- func LeftData(a map[string]interface{}, b map[string]interface{}) (rv map[string]interface{})
- func LowerCaseNames(a map[string]interface{}) (rv map[string]interface{})
- func NeedRebuild(parent string, optsRebuild bool, child string, child1 string, child2 string) bool
- func ParseBool(s string) (b bool)
- func Qt(format string, data map[string]string) string
- func QtR(format string, data map[string]interface{}) string
- func ReadJSONDataWithComments(path string) (file []byte, err error)
- func ReadJSONPath(pth string) map[string]string
- func RmExt(filename string) string
- func RowsToInterface(rows *sql.Rows) ([]map[string]interface{}, string, int)
- func RowsToJson(rows *sql.Rows) (string, string)
- func RowsToJsonFirstRow(rows *sql.Rows) (string, string)
- func Run1(db *sql.DB, q string, arg ...interface{}) error
- func Run1IdThx(db *sql.DB, trx *tr.Trx, q string, data ...interface{}) (err error, id string)
- func Run1Thx(db *sql.DB, trx *tr.Trx, q string, data ...interface{}) error
- func Run2(db *sql.DB, q string, arg ...interface{}) (nr int64, err error)
- func SVar(v interface{}) string
- func SVarI(v interface{}) string
- func SearchPath(rawFileName string, searchPath string) (fullFileName string, ok bool)
- func SearchPathApp(rawFileName string, appName string, searchPath string) (fullFileName string, ok bool)
- func SearchPathAppModule(rawFileName string, appName string, searchPath []string) (fullFileName []string, ok bool)
- func SelData(db *sql.DB, q string, data ...interface{}) []map[string]interface{}
- func SelData2(db *sql.DB, q string, data ...interface{}) ([]map[string]interface{}, error)
- func SelDataTrx(db *sql.DB, trx *tr.Trx, q string, data ...interface{}) []map[string]interface{}
- func SelQ(db *sql.DB, q string, data ...interface{}) (Rows *sql.Rows, err error)
- func SlugToUUID(slug string) (uuid string)
- func SubstitueUserInFilePath(s string, mdata map[string]string) (rs string, has bool)
- func SubstitueUserInFilePathImmediate(s string) (rs string)
- func TypeOf(v []interface{})
- func URIToStringMap(req *http.Request) (m url.Values, fr map[string]string)
- func UUIDAsStr() (s_id string)
- func UUIDAsStrPacked() (s_id string)
- func UUIDToSlug(uuid string) (slug string)
- func XVar(v interface{}) string
- func XVarI(v interface{}) string
- type MyDb
Constants ¶
const ISO8601 = "2006-01-02T15:04:05.99999Z07:00"
ISO format for date
const ISO8601output = "2006-01-02T15:04:05.99999-0700"
ISO format for date
const ReturnPacked = true
Variables ¶
var DbBeginQuote = `"`
var DbEndQuote = `"`
var IsBSD = false
var IsLinux = true
var IsUnix = true
var IsWindows = false
Functions ¶
func Basename ¶
------------------------------------------------------------------------------------------------- xyzzy - str. Return the basename from a file path. This is the last component with the directory path stripped off. File extension removed. -------------------------------------------------------------------------------------------------
func BasenameExt ¶
------------------------------------------------------------------------------------------------- xyzzy - str. With file extension -------------------------------------------------------------------------------------------------
func ConnectToDb ¶
func DbValueFromRow ¶
func DbValueIsNull ¶
func DumpVar ¶
func DumpVar(v interface{})
------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------
func EscapeDoubleQuote ¶
------------------------------------------------------------------------------------------------
func EscapeError ¶
func Exists ¶
------------------------------------------------------------------------------------------------- Tested Exists reports whether the named file or directory exists. -------------------------------------------------------------------------------------------------
func ExistsGetUDate ¶
-------------------------------------------------------------------------------------------------
type FileInfo interface { Name() string // base name of the file Size() int64 // length in bytes for regular files; system-dependent for others Mode() FileMode // file mode bits ModTime() time.Time // modification time IsDir() bool // abbreviation for Mode().IsDir() Sys() interface{} // underlying data source (can return nil) }
Tested Exists reports whether the named file or directory exists. -------------------------------------------------------------------------------------------------
func ExistsIsDir ¶
func ExtendData ¶
func ExtendDataS ¶
func ExtendStringMap ¶
ExtendStringMap merges map of restuls from multiple JSON reads
func FilesMatchingPattern ¶
func FilterArray ¶
------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------
func FindDirsWithSQLCfg ¶
FindDirsWithSQLCfg searches a possibly recursive set of directories looking for directories containing sql-cfg*.json file.
func FnToCSSClass ¶
------------------------------------------------------------------------------------------------- xyzzy - str. Tested -------------------------------------------------------------------------------------------------
func GetFile ¶
------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------
func GetFilenames ¶
------------------------------------------------------------------------------------------------- Get a list of filenames and directorys. xyzzy - fil. -------------------------------------------------------------------------------------------------
func GetIPFromRemoteAddr ¶
GetIPFromRemoteAddr get client ip address from request
Example: ip,_,_ := net.SplitHostPort(r.RemoteAddr)
func GetImageFiles ¶
------------------------------------------------------------------------------------------------- list of image files in a directory -------------------------------------------------------------------------------------------------
func HasKeys ¶
------------------------------------------------------------------------------------------------ func HasKeys ( v map[string]Validation ) bool {
func InArray ¶
------------------------------------------------------------------------------------------------- xyzzy - str. -------------------------------------------------------------------------------------------------
func InsSel ¶
------------------------------------------------------------------------------------------------- xyzzy-Rewrite
mdata["group_id"] = insSel ( "select \"id\" from \"img_group\" where \"group_name\" = '%{user_id%}'",
------------------------------------------------------------------------------------------------- :pgx:func InsSel(db *pgx.Conn, sel string, ins string, mdata map[string]string) (id string) {
func InsUpd ¶
------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------- :pgx:func InsUpd(db *pgx.Conn, ins string, upd string, mdata map[string]string) {
func IntersectData ¶
Keep the data that has common keys between 'a' and 'b', prefering data from 'b' not used at the moment.
func IsIntString ¶
func JSONStringToData ¶
JsonStringToData convert from a string to a map[string]interface{} - parse JSON
func LowerCaseNames ¶
------------------------------------------------------------------------------------------------ Copy 'a', then copy 'b' over 'a' Tests: t-extendData.go ------------------------------------------------------------------------------------------------ jDataDefaults = lowerCaseNames ( jDataDefaults )
func NeedRebuild ¶
------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------
func Qt ¶
Qt Quick template %{name%} gets replace with substitution from map if it is in map, else ""
func ReadJSONDataWithComments ¶
ReadJSONDataWithComments read in the file and handle __LINE__, __FILE__ and comments starting with 4 slashes.
func ReadJSONPath ¶
read JSON file to map -------------------------------------------------------------------------------------------------
func RmExt ¶
------------------------------------------------------------------------------------------------- Tested -------------------------------------------------------------------------------------------------
func RowsToInterface ¶
------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------- :pgx:func RowsToInterface(rows *pgx.Rows) ([]map[string]interface{}, string, int) {
func RowsToJson ¶
------------------------------------------------------------------------------------------------- Rows to JSON -- Go from a set of "rows" returned by db.Query to a JSON string. ------------------------------------------------------------------------------------------------- :pgx:func RowsToJson(rows *pgx.Rows) (string, string) {
func RowsToJsonFirstRow ¶
------------------------------------------------------------------------------------------------- Rows to JSON -- Go from a set of "rows" returned by db.Query to a JSON string. ------------------------------------------------------------------------------------------------- :pgx:func RowsToJsonFirstRow(rows *pgx.Rows) (string, string) {
func Run1 ¶
------------------------------------------------------------------------------------------------- test: t-run1q.go, .sql, .out ------------------------------------------------------------------------------------------------- :pgx:func Run1(db *pgx.Conn, q string, arg ...interface{}) error {
func Run2 ¶
:pgx:func Run2(db *pgx.Conn, q string, arg ...interface{}) (nr int64, err error) { :pgx: nr = 0 :pgx: err = nil :pgx: :pgx: h := HashStr.HashStrToName(q) + q :pgx: :pgx: //tr.TraceDb2 ( "Run1", q, arg... ) :pgx: ps, err := db.Prepare(h, q) :pgx: if err != nil { :pgx: //tr.TraceDbError2 ( "Run1.(Prepare)", q, err ) :pgx: return :pgx: } :pgx: _ = ps :pgx: :pgx: // R, err := stmt.Exec(h, arg...) :pgx: R, err := db.Exec(h, arg...) :pgx: if err != nil { :pgx: //tr.TraceDbError2 ( "Run1.(Exec)", q, err ) :pgx: return :pgx: } :pgx: :pgx: //nr, err = R.RowsAffected() :pgx: //if err != nil { :pgx: // //tr.TraceDbError2 ( "Run1.(Exec)", q, err ) :pgx: // return :pgx: //} :pgx: nr = R.RowsAffected() :pgx: :pgx: //tr.TraceDbEnd ( "Run1.(*Success*)", q, 0 ) :pgx: return :pgx:}
func SVar ¶
func SVar(v interface{}) string
SVar convert a variable to it's JSON representation and return
func SVarI ¶
func SVarI(v interface{}) string
SVarI convert a variable to it's JSON representation with indendted JSON
func SearchPath ¶
func SearchPathApp ¶
func SearchPathApp(rawFileName string, appName string, searchPath string) (fullFileName string, ok bool)
Perform a search for files and return the full name for each file.
rawFileName: sql-cfg.json appName: "store"
func SearchPathAppModule ¶
func SelData ¶
SelData seelct data from the database and return it. :pgx:func SelData(db *pgx.Conn, q string, data ...interface{}) []map[string]interface{} {
func SelData2 ¶
------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------- :pgx:func SelData2(db *pgx.Conn, q string, data ...interface{}) ([]map[string]interface{}, error) {
func SelDataTrx ¶
------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------- :pgx:func SelDataTrx(db *pgx.Conn, trx *tr.Trx, q string, data ...interface{}) []map[string]interface{} {
func SelQ ¶
------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------- :pgx:func SelQ(db *pgx.Conn, q string, data ...interface{}) (Rows *pgx.Rows, err error) {
func SlugToUUID ¶
func SubstitueUserInFilePath ¶
func TypeOf ¶
func TypeOf(v []interface{})
------------------------------------------------------------------------------------------------
func UUIDAsStrPacked ¶
func UUIDAsStrPacked() (s_id string)