Documentation
¶
Index ¶
- Constants
- Variables
- func AddBindValue(bind *[]interface{}, x interface{}) (pos int)
- func AddBindValueByType(bind *[]interface{}, vv WhereClause, ty string) (pos int)
- func CommonMakeData(h SQLOne, trx *tr.Trx, ps *goftlmux.Params) (data []interface{})
- func ConfigEmailAWS(hdlr *TabServer2Type, file string)
- func DoGet(uri string, args ...string) (status int, rv string)
- func EndTrx(w *goftlmux.MidBuffer, req *http.Request, ps *goftlmux.Params) int
- func ExtendeAttributes(vv WhereClause, wc WhereClause, trx *tr.Trx, h SQLOne, bind *[]interface{}, ...) (processed bool, rv string, err error)
- func FindColNoInMeta(cols []ColSpec, aColName string) int
- func FuncMapExtend(name string, fx FuncMapType) (err error)
- func GenKey(h_Query string, typ string, tn string, data ...interface{}) string
- func GenPKWhereFromWc(wc WhereClause, trx *tr.Trx, h SQLOne, ps *goftlmux.Params) (isPk bool, err error)
- func GenRandBytes(nRandBytes int) (buf []byte, err error)
- func GenRandBytesOracle() (buf []byte, ttl, epoc int, err error)
- func GenRandNumber(nDigits int) (buf string, err error)
- func GenWhereFromWc(wc WhereClause, trx *tr.Trx, h SQLOne, bind *[]interface{}, ...) (string, error)
- func Get1stRowFromMap(kk map[string]interface{}) (rv interface{})
- func GetByNameWTrxLog(name string, ps *goftlmux.Params, err string, msg string, req *http.Request, ...) (xerr error, xal string)
- func GetColByType(attr_type string) string
- func GetDataInsert(cols []ColSpec, data map[string]interface{}) []interface{}
- func GetDataListAsArray(ty string, wc WhereClause, trx *tr.Trx, h SQLOne, bind *[]interface{}) (string, error)
- func GetDataListAsInList(ty string, wc WhereClause, trx *tr.Trx, h SQLOne, bind *[]interface{}) (string, error)
- func GetDataUpdate(cols []ColSpec, data map[string]interface{}) []interface{}
- func GetIpFromRemoteAddr(RemoteAddr string) (rv string)
- func GetMuxValue(name string, as string, mdata map[string]string, trx *tr.Trx, ...) string
- func GetQRForSetup(hdlr *TabServer2Type, www http.ResponseWriter, req *http.Request, ...) (html, QRImgURL, ID string, err error)
- func GetRedisCfgHandler2(name string, hdlr *TabServer2Type) func(www http.ResponseWriter, req *http.Request)
- func GetRequiredByValidation(name string, h SQLOne, crud_op string) (isRequired bool, hasValid bool)
- func GetRwHdlrFromWWW(www http.ResponseWriter, req *http.Request) (rw *goftlmux.MidBuffer, top_hdlr interface{}, ok bool)
- func GetRwPs(www http.ResponseWriter, req *http.Request) (rw *goftlmux.MidBuffer, top_hdlr interface{}, ps *goftlmux.Params, err error)
- func GetSI(s string, data map[string]interface{}) string
- func GetSqlCfgHandler2(name string, hdlr *TabServer2Type) func(www http.ResponseWriter, req *http.Request)
- func GetTypeCode(ty string) (rv string)
- func GetUrlValue(m url.Values, name string, dflt string) string
- func GetUrlValueErr(m url.Values, name string, dflt string) (string, error)
- func HasKeys(v map[string]Validation) bool
- func HaveColumn(ColumnName string, TableInfo DbTableType) (rv int)
- func IfNullInt64(x interface{}) int64
- func IfNullStr(x interface{}) string
- func InitTrx(w *goftlmux.MidBuffer, req *http.Request, ps *goftlmux.Params) int
- func InjectDataPs(ps *goftlmux.Params, h SQLOne, res http.ResponseWriter, req *http.Request)
- func IsColumnName(h SQLOne, Name string) bool
- func JsonP_3(data map[string]interface{}, res http.ResponseWriter, req *http.Request, ...) string
- func LoadEAData(table_name string, hdlr *TabServer2Type)
- func LogError(rv string, id string, status int, msg string, code string, details string, ...)
- func MapKeys(kk map[string]interface{}) (rv string)
- func NoLogData(data []interface{}, h SQLOne) []interface{}
- func RedisReferenced(FuncName string, cfgTag string, hdlr *TabServer2Type)
- func ReplaceString(s string, pat string, repl string) (rv string)
- func ReturnErrorMessage(status int, msg string, code string, details string, res http.ResponseWriter, ...)
- func ReturnErrorMessageRv(status int, rv string, msg string, code string, details string, ...)
- func SendEmailViaAWS(dSubject, dBodyHtml, dBodyText, email_addr string)
- func SetDataPs(trx *tr.Trx, ps *goftlmux.Params)
- func SignToken(tokData []byte, keyFile string) (out string, err error)
- func TablesReferenced(FuncName string, cfgTag string, TablesRefed []string, hdlr *TabServer2Type)
- func TraceUriPs(trx *tr.Trx, req *http.Request, ps *goftlmux.Params)
- func UseTemplate(tag string, XTmpl string, dflt string, mdata map[string]string, trx *tr.Trx) (Query string)
- func ValidateColInWhere(name string, h SQLOne) (ty string, err error)
- func ValidateNullOk(ColName string, ii int, h SQLOne, crud_op string) bool
- func ValidateQueryParams(ps *goftlmux.Params, h SQLOne, req *http.Request) (err error)
- func ValidateSetValue(ColName string, ii int, h SQLOne, dd string, req *http.Request) (err error)
- func ValidateTableCols(TheCols []ColSpec, TableInfo DbTableType) (rv bool)
- type ColSpec
- type CustomerIdPartBehavior
- type DbColumnsType
- type DbOperation
- type DbTableType
- type DbType
- type DelBehavior
- type EAAttributeInfo
- type ErrorLog
- type FuncMapType
- type LoginSystemType
- type OrdSpec
- type PostJoinType
- type PrePostFlagType
- func AfterPasswordChange(res http.ResponseWriter, req *http.Request, cfgTag string, rv string, ...) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
- func CacheEUser(res http.ResponseWriter, req *http.Request, cfgTag string, rv string, ...) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
- func ConvertErrorToCode(res http.ResponseWriter, req *http.Request, cfgTag string, rv string, ...) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
- func CreateJWTToken(res http.ResponseWriter, req *http.Request, cfgTag string, rv string, ...) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
- func DeCacheEUser(res http.ResponseWriter, req *http.Request, cfgTag string, rv string, ...) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
- func DumpRV(www http.ResponseWriter, req *http.Request, cfgTag string, rv string, ...) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
- func PubEMailToSend(res http.ResponseWriter, req *http.Request, cfgTag string, rv string, ...) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
- func RedirectTo(res http.ResponseWriter, req *http.Request, cfgTag string, rv string, ...) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
- func SendEmailMessage(res http.ResponseWriter, req *http.Request, cfgTag string, rv string, ...) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
- func SendEmailToGenMessage(res http.ResponseWriter, req *http.Request, cfgTag string, rv string, ...) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
- func SendReportsToGenMessage(res http.ResponseWriter, req *http.Request, cfgTag string, rv string, ...) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
- func Sleep(res http.ResponseWriter, req *http.Request, cfgTag string, rv string, ...) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
- func X2faSetup(www http.ResponseWriter, req *http.Request, cfgTag string, rv string, ...) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
- func X2faSetupPt2of2(www http.ResponseWriter, req *http.Request, cfgTag string, rv string, ...) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
- func X2faStash(www http.ResponseWriter, req *http.Request, cfgTag string, rv string, ...) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
- func X2faValidateToken(www http.ResponseWriter, req *http.Request, cfgTag string, rv string, ...) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
- type RanData
- type RedirectToData
- type RedisData
- type RemapParameterType
- type SQLOne
- type SesDataType
- type SesItems
- type SqlCfgLoaded
- type TabServer2Type
- func (hdlr *TabServer2Type) BindPlaceholder(n int) (rv string)
- func (hdlr *TabServer2Type) CacheItForLater(res http.ResponseWriter, req *http.Request, h SQLOne, id string, ...)
- func (hdlr *TabServer2Type) CacheItForLaterMk(res http.ResponseWriter, req *http.Request, h SQLOne, theData string)
- func (hdlr *TabServer2Type) CallFunction(ba string, fx_name string, www http.ResponseWriter, req *http.Request, ...) (string, PrePostFlagType, bool, int)
- func (hdlr *TabServer2Type) CheckSqlCfgValid() (isOk bool)
- func (hdlr *TabServer2Type) CommmonCrudPrefix(res http.ResponseWriter, req *http.Request, op string, ps *goftlmux.Params, ...) (ok bool, mdata map[string]string, cfgTag string, h SQLOne, trx *tr.Trx, ...)
- func (hdlr *TabServer2Type) CommonLimitOffset(mdata map[string]string, data *[]interface{}, h SQLOne, table_name string, ...) bool
- func (hdlr *TabServer2Type) CommonWhereClause(pkRequired bool, id string, idflag bool, mdata map[string]string, ...) (fail bool, isPk bool)
- func (hdlr *TabServer2Type) CreateMissingTable(conn *sizlib.MyDb, tn string) (err error)
- func (hdlr *TabServer2Type) CrudErrMsg(depth int, msg string, err error, col string, trx *tr.Trx, ...)
- func (hdlr *TabServer2Type) DbEnabledOn(www http.ResponseWriter, s string) bool
- func (hdlr *TabServer2Type) ExecSProcCmd(name string, np int) (rv string, err error)
- func (hdlr *TabServer2Type) ExtendedWhereCaluse(mdata map[string]string, h SQLOne, data *[]interface{}, trx *tr.Trx, ...) (ok bool)
- func (hdlr *TabServer2Type) GenInsUpdInfo(table_key string, jData map[string]interface{}, mdata map[string]string)
- func (hdlr *TabServer2Type) GenInsertValues(h SQLOne, trx *tr.Trx, data *[]interface{}, mdata map[string]string, n_col int, ...) (ok bool, s_id string)
- func (hdlr *TabServer2Type) GenKeyMk(h SQLOne, ps *goftlmux.Params) string
- func (hdlr *TabServer2Type) GenOrderBy(mdata map[string]string, h SQLOne, trx *tr.Trx, res http.ResponseWriter, ...) bool
- func (hdlr *TabServer2Type) GenProjectedCols(mdata map[string]string, h SQLOne, trx *tr.Trx, ps *goftlmux.Params)
- func (hdlr *TabServer2Type) GenTemplate(h SQLOne, op string, mdata map[string]string, wc *WhereCollect, ...) (string, error)
- func (hdlr *TabServer2Type) GenUpdateSet(h SQLOne, trx *tr.Trx, data *[]interface{}, mdata map[string]string, ...) bool
- func (hdlr *TabServer2Type) Get2MinHashFunc() (hash string, ttlLeft int, err error)
- func (hdlr *TabServer2Type) GetDataList(ty string, wc WhereClause, trx *tr.Trx, h SQLOne, bind *[]interface{}) (string, error)
- func (hdlr *TabServer2Type) GetDbType() DbType
- func (hdlr *TabServer2Type) GetFunctionInformationSchema(conn *sizlib.MyDb, FunctionName string, Params []string) (rv DbTableType, err error)
- func (hdlr *TabServer2Type) GetPkName(h SQLOne, nPkCols int, trx *tr.Trx, res http.ResponseWriter, req *http.Request, ...) ([]string, bool)
- func (hdlr *TabServer2Type) GetRedisKey(key string) (rv string, err error)
- func (hdlr *TabServer2Type) GetStoredProcedurePlist(np int) (rv string)
- func (hdlr *TabServer2Type) GetTableInformationSchema(conn *sizlib.MyDb, TableName string) (rv DbTableType, err error)
- func (hdlr *TabServer2Type) GetUserIDFromAuthToken(auth_token string) (user_id string, err error)
- func (hdlr *TabServer2Type) GetValidList(user_id string) (list []string, err error)
- func (hdlr *TabServer2Type) HasPKInWhere(mdata map[string]string, h SQLOne, trx *tr.Trx, res http.ResponseWriter, ...) (hasPk bool)
- func (hdlr *TabServer2Type) HaveCachedData(res http.ResponseWriter, req *http.Request, h SQLOne, h_Query string, ...) (rv string, found bool)
- func (hdlr *TabServer2Type) HaveCachedDataMk(res http.ResponseWriter, req *http.Request, h SQLOne) (data string, found bool)
- func (hdlr *TabServer2Type) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, ...) (err error)
- func (hdlr *TabServer2Type) PickInsertUpdateColumns(www http.ResponseWriter, theFile0 map[string]interface{}, table_key string) (rv map[string]interface{})
- func (hdlr *TabServer2Type) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, ...) (err error)
- func (hdlr *TabServer2Type) ProcessErrors(www http.ResponseWriter, req *http.Request, rvIn string, errorCode int, ...) (rv string)
- func (hdlr *TabServer2Type) PullQRURLFromDB() (qr_enc_id, qr_url string, err error)
- func (hdlr *TabServer2Type) RemapParams(ps *goftlmux.Params, h SQLOne, trx *tr.Trx)
- func (hdlr *TabServer2Type) RespHandlerRedis(res http.ResponseWriter, req *http.Request, cfgTag string, ps *goftlmux.Params, ...)
- func (hdlr *TabServer2Type) RespHandlerSQL(res http.ResponseWriter, req *http.Request, cfgTag string, ps *goftlmux.Params, ...)
- func (hdlr *TabServer2Type) ServeHTTP(www http.ResponseWriter, req *http.Request)
- func (hdlr *TabServer2Type) TemplateEmail(template_name string, mdata map[string]string) (s1, b1, b2 string, err error)
- func (hdlr *TabServer2Type) UpdateQRMarkAsUsed(qrId string) error
- func (hdlr *TabServer2Type) ValidateUserTrx(h SQLOne, trx *tr.Trx, res http.ResponseWriter, req *http.Request, ...) (err error)
- type Validation
- type ValidationIn
- type WhereClause
- type WhereCollect
Constants ¶
const ISO8601 = "2006-01-02T15:04:05.99999Z07:00"
const MAX_MEMORY = 10 * 1024 * 1024
Variables ¶
var DbBeginQuote = `"`
var DbEndQuote = `"`
var EADataLoaded map[string]bool
var EA_Data map[string]map[string]EAAttributeInfo
var FirstRequest bool = true
============================================================================================================================================
var Hostname string = ""
var Init_Main []func(theMux *goftlmux.MuxRouter)
var InvalidUser = errors.New("Invalid user")
var LastResut []byte
var MissingValueError = errors.New("Missing Value")
var SqlCfgFilesLoaded []SqlCfgLoaded
var ThisEpoc int
var TimeRemain int
Functions ¶
func AddBindValue ¶
func AddBindValue(bind *[]interface{}, x interface{}) (pos int)
func AddBindValueByType ¶
func AddBindValueByType(bind *[]interface{}, vv WhereClause, ty string) (pos int)
func CommonMakeData ¶
==================================================================================================================================================================== ====================================================================================================================================================================
func ConfigEmailAWS ¶
func ConfigEmailAWS(hdlr *TabServer2Type, file string)
func DoGet ¶
Modified to send Header!
--------------------------------------------- // Xyzzy101 - Setup QR Redirect ---------------------------------------------
export QR_SHORT_AUTH_TOKEN="w4h0wvtb1zk4uf8Xv.Ns9Q7j8" wget -o out/,list1 -O out/,list2 \ --header "X-Qr-Auth: ${QR_SHORT_AUTH_TOKEN}" \ "http://t432z.com/upd/?url=http://test.test.com&id=5c" -- 1. DoGet - change to create a header -- 2. Example Call to set this
func ExtendeAttributes ¶
func ExtendeAttributes(vv WhereClause, wc WhereClause, trx *tr.Trx, h SQLOne, bind *[]interface{}, hdlr *TabServer2Type) (processed bool, rv string, err error)
xyzzy - missing $customer_id$ if set/used
http://tech.pro/tutorial/1142/building-faceted-search-with-postgresql -- faceted-filters.html (saved) http://www.postgresql.org/docs/8.3/static/textsearch-indexes.html http://stackoverflow.com/questions/1540374/why-are-postgresql-text-search-gist-indexes-so-much-slower-than-gin-indexes http://www.youlikeprogramming.com/2012/01/full-text-search-fts-in-postgresql-9-1/ -- trigger to update tsvecotr colum/index
http://blog.timothyandrew.net/blog/2013/06/24/recursive-postgres-queries/ http://stackoverflow.com/questions/11834579/postgresql-hierarchical-category-tree -- Category Example With Queries https://gist.github.com/chanmix51/3225313 -- GIST example with get_chilren_of, get_parent_of, list and create table stuff
select * from p_get_children_of ( '{"guns","stock"}'::varchar[] );
, "key_word_col_name": "key_word" , "key_word_list_col": "__keyword__" , "key_word_tmpl": " %{kw_col%} @@ plainto_tsquery( %{kw_vals%} ) "
, "category_col_name": "category" , "category_col": "category_id" , "category_tmpl": " %{cat_col%} in ( select c1.\"id\" from p_get_children_of ( '%{cat_val%}'::varchar[] ) ) "
, "attr_table_name": "p_cart" , "attr_col": "id" , "attr_tmpl":" %{pk_attr_id%} in ( select a1.\"fk_id\" from \"p_attr\" as a1 where a1.\"attr_type\" = %{attr_type%} and a1.\"attr_name\" = %{attr_name%} and a1.\"%{ref_col%}\" %{attr_op%} %{attr_val%} )"
Key_word_col_name string Key_word_list_col string Key_word_tmpl string Category_col_name string Category_col string Category_tmpl string Attr_table_name string Attr_col string Attr_tmpl string
func FindColNoInMeta ¶
============================================================================================================================================================================== test: t-pp1.go ==============================================================================================================================================================================
func FuncMapExtend ¶
func FuncMapExtend(name string, fx FuncMapType) (err error)
FuncMapExtend will add a new named fucntion to the set of callable functions. This allows new modules to be build and use the pre-post processing.
func GenKey ¶
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
func GenPKWhereFromWc ¶
func GenPKWhereFromWc(wc WhereClause, trx *tr.Trx, h SQLOne, ps *goftlmux.Params) (isPk bool, err error)
==================================================================================================================================================================== ====================================================================================================================================================================
func GenRandBytes ¶
============================================================================================================================================ Should move to aesccm package
func GenRandBytesOracle ¶
============================================================================================================================================ Should move to aesccm package
func GenRandNumber ¶
Generate a random number, 0..N, returned as a string with 6 to 8 non-zero digits.
func GenWhereFromWc ¶
func GenWhereFromWc(wc WhereClause, trx *tr.Trx, h SQLOne, bind *[]interface{}, hdlr *TabServer2Type) (string, error)
The where clause is passed as a parse tree, 'wc'. This is to be translated into a corresponding string and returned. This somewhat limits what can be passed as a where clause. This also prevents SQL injection. If you need a more complex where clause then a stored procedure can be written that is specific to the task at hand.
func Get1stRowFromMap ¶
func Get1stRowFromMap(kk map[string]interface{}) (rv interface{})
func GetByNameWTrxLog ¶
func GetByNameWTrxLog(name string, ps *goftlmux.Params, err string, msg string, req *http.Request, trx *tr.Trx) (xerr error, xal string)
Consider caching the tokens in memory for this server - fetch onece from Redis then cache.
func GetColByType ¶
func GetDataInsert ¶
============================================================================================================================================================================== ============================================================================================================================================================================== return an array of data for insert statment xyzzy -did they all get data??? -- input-Requried, update-Required
func GetDataListAsArray ¶
func GetDataListAsArray(ty string, wc WhereClause, trx *tr.Trx, h SQLOne, bind *[]interface{}) (string, error)
Used in categories - this is a postgresql specific function.
func GetDataListAsInList ¶
func GetDataListAsInList(ty string, wc WhereClause, trx *tr.Trx, h SQLOne, bind *[]interface{}) (string, error)
xyzzy5000 qt_m["cat_col"] = fmt.Sprintf(`%s%s%s%s`, h.setWhereAlias, DbBeginQuote, h.Category_col, DbEndQuote) t, _ := GetDataListAsInList("s", vv, trx, h, bind) Used in categories - this is a postgresql specific function. -- Sets up an in list.
func GetDataUpdate ¶
============================================================================================================================================================================== ==============================================================================================================================================================================
func GetIpFromRemoteAddr ¶
func GetMuxValue ¶
func GetMuxValue(name string, as string, mdata map[string]string, trx *tr.Trx, res http.ResponseWriter, req *http.Request, ps goftlmux.Params) string
============================================================================================================================================================================== Pull out a value from the URL using mux.Vars - save it in common store. ==============================================================================================================================================================================
func GetQRForSetup ¶
func GetQRForSetup(hdlr *TabServer2Type, www http.ResponseWriter, req *http.Request, ps *goftlmux.Params, user_id string) (html, QRImgURL, ID string, err error)
func GetRedisCfgHandler2 ¶
func GetRedisCfgHandler2(name string, hdlr *TabServer2Type) func(www http.ResponseWriter, req *http.Request)
func GetRequiredByValidation ¶
func GetRequiredByValidation(name string, h SQLOne, crud_op string) (isRequired bool, hasValid bool)
==================================================================================================================================================================== ====================================================================================================================================================================
func GetRwHdlrFromWWW ¶
func GetRwHdlrFromWWW(www http.ResponseWriter, req *http.Request) (rw *goftlmux.MidBuffer, top_hdlr interface{}, ok bool)
============================================================================================================================================
func GetRwPs ¶
func GetRwPs(www http.ResponseWriter, req *http.Request) (rw *goftlmux.MidBuffer, top_hdlr interface{}, ps *goftlmux.Params, err error)
func respHandlerCreateNewDeviceId(www http.ResponseWriter, req *http.Request) { if rw, ok := www.(*goftlmux.MidBuffer); ok {
func GetSI ¶
==============================================================================================================================================================================
func GetSqlCfgHandler2 ¶
func GetSqlCfgHandler2(name string, hdlr *TabServer2Type) func(www http.ResponseWriter, req *http.Request)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Create the "closure" fucntion that will save passed data for later and return a function bound to the passed data. func Hello(w http.ResponseWriter, r *http.Request, ps goftlmux.Params) {
func GetTypeCode ¶
func GetUrlValue ¶
===============================================================================================================================================================================================
func GetUrlValueErr ¶
===============================================================================================================================================================================================
func HasKeys ¶
func HasKeys(v map[string]Validation) bool
func HaveColumn ¶
func HaveColumn(ColumnName string, TableInfo DbTableType) (rv int)
func IfNullInt64 ¶
func IfNullInt64(x interface{}) int64
func InjectDataPs ¶
func IsColumnName ¶
============================================================================================================================================================================== Return true if Name is a column name. ==============================================================================================================================================================================
func JsonP_3 ¶
func JsonP_3(data map[string]interface{}, res http.ResponseWriter, req *http.Request, ps goftlmux.Params, trx *tr.Trx) string
xyzzy - remove - midldware takes care of this
func LoadEAData ¶
func LoadEAData(table_name string, hdlr *TabServer2Type)
func LogError ¶
func LogError(rv string, id string, status int, msg string, code string, details string, res http.ResponseWriter, req *http.Request, ps goftlmux.Params, trx *tr.Trx, hdlr *TabServer2Type)
============================================================================================================================================================================ Log errors to Redis - with the unique error ID code
-- sample error --
rv = fmt.Sprintf(`{ "status":"error", "msg":"Error(10034): Invalid Where Clause; %s", %s }`, sizlib.EscapeError(err), godebug.LFj()) trx.AddNote(2, rv) trx.SetQryDone(rv, "") io.WriteString(res, sizlib.JsonP(rv, res, req))
func NoLogData ¶
func NoLogData(data []interface{}, h SQLOne) []interface{}
============================================================================================================================================================================== func InjectDataPs(ps *goftlmux.Params, h SQLOne, res http.ResponseWriter, req *http.Request) {
Issue00079: NoLog parameters Issue00018: Actual CC Processing with account + fake cards 4 hr 2. NoLog parameters 3. Put in actual test params with account - see that it works
==============================================================================================================================================================================
func RedisReferenced ¶
func RedisReferenced(FuncName string, cfgTag string, hdlr *TabServer2Type)
func ReturnErrorMessage ¶
func ReturnErrorMessage(status int, msg string, code string, details string, res http.ResponseWriter, req *http.Request, ps goftlmux.Params, trx *tr.Trx, hdlr *TabServer2Type)
============================================================================================================================================================================
Example of return information from error.
HTTP/1.1 401 Unauthorized { "status": "Error" , "msg": "No access token provided." , "code": "10002" , "details": "bla bla bla" } Error Meaning Usage in this code ----- -------------------------- ------------ 400 Bad Request x 401 Unauthorized Invalid token or un/pw is invalid during login 402 Payment Required x 403 Forbidden Accessing an invalid resource in a table - or an invalid table - login or token required 404 Not Found No such file, no such table 405 Method Not Allowed x 406 Not Acceptable Invalid parameters - see body for details 412 Precondition Failed x 417 Expectation Failed x 428 Precondition Required x 500 Internal Server Error x 501 http. StatusBadRequest = 400 StatusUnauthorized = 401 StatusPaymentRequired = 402 StatusForbidden = 403 StatusNotFound = 404 StatusMethodNotAllowed = 405 StatusNotAcceptable = 406 StatusProxyAuthRequired = 407 StatusRequestTimeout = 408 StatusConflict = 409 StatusGone = 410 StatusLengthRequired = 411 StatusPreconditionFailed = 412 StatusRequestEntityTooLarge = 413 StatusRequestURITooLong = 414 StatusUnsupportedMediaType = 415 StatusRequestedRangeNotSatisfiable = 416 StatusExpectationFailed = 417 StatusTeapot = 418 StatusInternalServerError = 500 StatusNotImplemented = 501 StatusBadGateway = 502 StatusServiceUnavailable = 503 StatusGatewayTimeout = 504 StatusHTTPVersionNotSupported = 505
func ReturnErrorMessageRv ¶
func SendEmailViaAWS ¶
func SendEmailViaAWS(dSubject, dBodyHtml, dBodyText, email_addr string)
func SignToken ¶
Create, sign, and output a token. This is a great, simple example of how to use this library to create and sign a token.
func TablesReferenced ¶
func TablesReferenced(FuncName string, cfgTag string, TablesRefed []string, hdlr *TabServer2Type)
------------------------------------------------------------------------------------------------ Save tables referened to Redis
Note:
h := SQLCfg[cfgTag]
------------------------------------------------------------------------------------------------
func TraceUriPs ¶
trx.TraceUriPs(req, ps) // xyzzyBoom11111 ---------------------------------------------------------------------------------------------------------- ps is convered ps.DumpParams() from the Params package // ps *goftlmux.Params func (this *Trx) TraceUriPs(req *http.Request, ps string) {
func UseTemplate ¶
func UseTemplate(tag string, XTmpl string, dflt string, mdata map[string]string, trx *tr.Trx) (Query string)
=================================================================================================================================================== ===================================================================================================================================================
func ValidateNullOk ¶
==================================================================================================================================================================== ==================================================================================================================================================================== nullOk := ValidateNullOk ( v.ColName, ii, h, "insert" ) "key" is for generation of a "key" into caching. Should return constant false. "where" caluse - can not have a "where" x = null situraiton - return false.
func ValidateQueryParams ¶
------------------------------------------------------------------------------------------------ 3. Add in other types - and checks 4. Add in RegEx for match 5. Add in "email", "ip", etc. ------------------------------------------------------------------------------------------------
func ValidateSetValue ¶
==================================================================================================================================================================== Validate the set of columns passed based on 'h.valid' Used in "set" for update, func GenUpdateSet ( h SQLOne, m url.Values, ... Used in "insert" values section, func GenInsertValues ( h SQLOne, ... ====================================================================================================================================================================
func ValidateTableCols ¶
func ValidateTableCols(TheCols []ColSpec, TableInfo DbTableType) (rv bool)
Types ¶
type ColSpec ¶
type ColSpec struct { ColName string // ColAlias string // ColType string // ColLen int // IsPk bool // IsIndexed bool // Insert bool // Update bool // AutoGen bool // OrderBy string // Values []string // DefaultData string // Default data to use if not supplied in insert DolNo int // DolNoUpd int // NoSort bool // ColTitle string // DataColName string // Column to use from user data for insert "ColName" in table }
test: t-pp1.go
type CustomerIdPartBehavior ¶
type DbColumnsType ¶
type DbOperation ¶
type DbOperation struct { Op string // One of "select", "call", "trxNote" Q string // Primary data parameter, "call" == stored procedure name, "select" == query, "trxNote" == the note P []string // Parameters to use Done string // if != "", then what to do after this - this is "done" Onerror string // OnError - If an error occured in a query, then what to do Onsuccess string // OnSuccess - If success occured, then "done" => return data, "discard" => Discard data on success, continue CallBefore []string CallAfter []string }
type DbTableType ¶
type DbTableType struct { TableName string DbColumns []DbColumnsType }
type DelBehavior ¶
type DelBehavior struct { ColType string ColName string Absent string Present string ColAlias string }
deleteBehavior: { "colName": "isDeleted", "colType": "s|b|i", "Deleted":"1", "Present":"0" } , "deleteViaUpdate": { "colType":"i", "colName":"isDeleted", "Absent":1, "Present":0 }
type EAAttributeInfo ¶
type EAAttributeInfo struct { Attr_type string Seq_no int64 Fuzzy_search string Attr_synonyms string Default_value string Min_value string Max_value string Value_list string Check_valid_data string }
func EALookup ¶
func EALookup(name string, table_name string, hdlr *TabServer2Type) (bool, *EAAttributeInfo)
xyzzy synonyms for columns xyzzy count of values for columns in context
type FuncMapType ¶
type LoginSystemType ¶
type LoginSystemType int
const ( LstNone LoginSystemType = 1 LstAesSrp LoginSystemType = 2 LstUnPw LoginSystemType = 3 LstBasic LoginSystemType = 4 )
func (LoginSystemType) String ¶
func (lst LoginSystemType) String() string
type PostJoinType ¶
type PostJoinType struct { ColName string ColType string // only 's' or 'i' make sence for partitioning customers ColAlias string Query string P []string SetCol string PostJoin []PostJoinType }
, PostJoin: [
{ "ColName": "bob", "ColType":"s", "Query": "select...", "p":[ ... ], "SetCol": "bobArray" } ]
type PrePostFlagType ¶
type PrePostFlagType int
const ( PrePostNextStep PrePostFlagType = 1 // Just procede to next processing step. PrePostRVUpdatedSuccess PrePostFlagType = 20 // rv written, use 'status' - processing complete. exit=true PrePostRVUpdatedFail PrePostFlagType = 21 // rv written, use 'status' - processing complete. exit=true PrePostContinue PrePostFlagType = 2 // go to next processing, neither 'rv' or 'satus' relevant. if 'rv' modified but is passed to next call. PrePostFatalSetStatus PrePostFlagType = 23 // Fatal Error: set status. exit=true, rv written by pre-post already. PrePostSuccessWriteRV PrePostFlagType = 30 // rv is updated, please write. )
Pre-Post fucntion calls return a status that indicates what is to happen next. In the past this has been a true/false - this was a bad choice. This set of values is to repace the 2nd return value from fuctions like X2faSetup.
Hopefully this will clarify the processing after a call to a pre/post procesing function.
func AfterPasswordChange ¶
func CacheEUser ¶
func ConvertErrorToCode ¶
func ConvertErrorToCode(res http.ResponseWriter, req *http.Request, cfgTag string, rv string, isError bool, cookieList map[string]string, ps *goftlmux.Params, trx *tr.Trx, hdlr *TabServer2Type) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
Error Meaning ----- -------------------------------------- 400 Bad Request 401 Unauthorized 402 Payment Required 403 Forbidden 404 Not Found 405 Method Not Allowed 406 Not Acceptable 412 Precondition Failed 417 Expectation Failed 428 Precondition Required
http.
StatusBadRequest = 400 StatusUnauthorized = 401 StatusPaymentRequired = 402 StatusForbidden = 403 StatusNotFound = 404 StatusMethodNotAllowed = 405 StatusNotAcceptable = 406 StatusProxyAuthRequired = 407 StatusRequestTimeout = 408 StatusConflict = 409 StatusGone = 410 StatusLengthRequired = 411 StatusPreconditionFailed = 412 StatusRequestEntityTooLarge = 413 StatusRequestURITooLong = 414 StatusUnsupportedMediaType = 415 StatusRequestedRangeNotSatisfiable = 416 StatusExpectationFailed = 417 StatusTeapot = 418 StatusInternalServerError = 500 StatusNotImplemented = 501 StatusBadGateway = 502 StatusServiceUnavailable = 503 StatusGatewayTimeout = 504 StatusHTTPVersionNotSupported = 505
func CreateJWTToken ¶
func CreateJWTToken(res http.ResponseWriter, req *http.Request, cfgTag string, rv string, isError bool, cookieList map[string]string, ps *goftlmux.Params, trx *tr.Trx, hdlr *TabServer2Type) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
xyzzy-JWT
func DeCacheEUser ¶
func PubEMailToSend ¶
func RedirectTo ¶
func RedirectTo(res http.ResponseWriter, req *http.Request, cfgTag string, rv string, isError bool, cookieList map[string]string, ps *goftlmux.Params, trx *tr.Trx, hdlr *TabServer2Type) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
RedirectTo should be the last step in a chain of post calls. It is final. Data is written to do the redirct and status is set.
func SendEmailMessage ¶
func SendEmailMessage(res http.ResponseWriter, req *http.Request, cfgTag string, rv string, isError bool, cookieList map[string]string, ps *goftlmux.Params, trx *tr.Trx, hdlr *TabServer2Type) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
l_data = '{"status":"success","$send_email$":{'
||'"template":"please_confirm_registration"' ||',"username":'||to_json(p_username) ||',"real_name":'||to_json(p_real_name) ||',"email_token":'||to_json(l_email_token) ||',"app":'||to_json(p_app) ||',"name":'||to_json(p_name) ||',"url":'||to_json(p_url) ||',"from":'||to_json(l_from) ||'},"$session$":{' ||'"set":[' ||'{"path":["gen","auth"],"value":"y"}' ||']' ||'}}';
func SendEmailToGenMessage ¶
func SendReportsToGenMessage ¶
func X2faSetup ¶
func X2faSetup(www http.ResponseWriter, req *http.Request, cfgTag string, rv string, isError bool, cookieList map[string]string, ps *goftlmux.Params, trx *tr.Trx, hdlr *TabServer2Type) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
return "", PrePostFatalSetStatus, true, 500 return rv, PrePostFatalSetStatus, true, 500 return rv, PrePostContinue, exit, a_status
xyzzy-2fa - X2faSetup type PrePostFlagType int - to replace 'bool' type.
func X2faSetupPt2of2 ¶
func X2faSetupPt2of2(www http.ResponseWriter, req *http.Request, cfgTag string, rv string, isError bool, cookieList map[string]string, ps *goftlmux.Params, trx *tr.Trx, hdlr *TabServer2Type) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
Part1of2 is X2faStash
func X2faValidateToken ¶
func X2faValidateToken(www http.ResponseWriter, req *http.Request, cfgTag string, rv string, isError bool, cookieList map[string]string, ps *goftlmux.Params, trx *tr.Trx, hdlr *TabServer2Type) (rvOut string, pptFlag PrePostFlagType, exit bool, a_status int)
xyzzy-2fa - X2faValidateToken rv - return value string - JSON rexit, if true, then will return with error from parent rstatus - status to return with
return "", PrePostFatalSetStatus, true, 500 return rv, PrePostFatalSetStatus, true, 500 return rv, PrePostContinue, exit, a_status
func X2faValidateToken(www http.ResponseWriter, req *http.Request, cfgTag string, rv string, isError bool, cookieList map[string]string, ps *goftlmux.Params, trx *tr.Trx, hdlr *TabServer2Type) (rrv string, rexit bool, rstatus int) {
type RedirectToData ¶
type RemapParameterType ¶
type SQLOne ¶
type SQLOne struct { F string // Depricated in favor of Fx or G Fx string // G string // Gx string // Extended function call, instead of just return 'x' will look at names of function and return and use that P []string // Popt []string // Pname []string // Exec []DbOperation // SetCookie map[string]bool // SetSession map[string]bool // // don't know if this is correct yet // Query string // Valid map[string]ValidationIn // ValidGet map[string]ValidationIn // ValidPost map[string]ValidationIn // ValidPut map[string]ValidationIn // ValidDel map[string]ValidationIn // LoginRequired bool // Defaults to false, no login required (formerly nokey) Redis bool // CacheIt string // TableName string // xyzzy921 - Should override URL - not doing this currently - need to do this. -- Should be put in TableList also xyzzy Method []string // Crud []string // Cols []ColSpec // OrderBy []OrdSpec // ReadOnly string // NoLog []string // Skip logging of these parametes to the call. Repalce each chareacter in Trx log with '*' CallBefore []string // CallAfter []string // TableList []string // LineNo string // SelectTmpl string // SelectPK1Tmpl string // SelectCountTmpl string // InsertTmpl string // UpdateTmpl string // DeleteTmpl string // ReturnGetPKAsHash bool // On get via Primary Key - should a 1 long array be returned or just the hash inside the array, true if hash -- Overidden by ReturnMeta, ReturnAsHash ReturnGetPKAsHashTableName bool // If ReturnGetPkAsHash is true then either use "data" or if this is true use the "assigned_name" AssignedName string // if "", then use TableName if ReturnGetPKAsHashTableName is true. ReturnMeta bool // Return as { "data": [ ... ], "meta": { "count": n } } ReturnAsHash bool // Return as { "data": [ ... ] } CmdList []string // DebugFlag []string // set of debuging flags true/flase FromKey string DeleteViaUpdate DelBehavior // Specification for delete/undelete with marker in row. CustomerIdPart CustomerIdPartBehavior SetWhereAlias string PostJoin []PostJoinType CachePostJoin bool Key_word_col_name string Key_word_list_col string Key_word_tmpl string Category_col_name string Category_col string Category_tmpl string Attr_table_name string Attr_col string Attr_tmpl string Tag_col_name string Tag_col string Tag_tmpl string ReMapParameter []RemapParameterType Comment string Status string `json:"status"` OracleSequenceName string // xyzzyOracle - not used yet // contains filtered or unexported fields }
test: t-pp1.go
type SesDataType ¶
type SesDataType struct {
Set []SesItems
}
func ConvRawSesData ¶
func ConvRawSesData(ss string) (rv SesDataType)
type SqlCfgLoaded ¶
type TabServer2Type ¶
type TabServer2Type struct { Next http.Handler // No Next, this is the bottom of the stack. Paths []string // AppRoot []string // The patth where to start searhing for sql-cfg-<name>.json files -- Formerly TopPath DbFunctions []string // Functions to turn on debugging output in. WatchForConfigChanges bool // If true then a 2nd process will be started to watch for changes in config files. SQLCfgFN string // xyzzy AppName string // xyzzy SearchPath string // a search path like "~/cfg:./cfg" -- defaults to ./cfg:.:~/cfg Final string // If a path is matched with Paths, but not with the final routing, say /api/table/BADNAME, then if Final => 404 error DevAuthToken string // Password for accessing ListSqlConfigFilesLoaded DebugFlags []string // Debuging Flags for example, "credit_card_test_mode" AuthorizeNetLogin string // AuthorizeNetKey string // StatusMessage string // Message printed out as a part of status - can be version number for the config file LogToFile string // if "" then logging is off, else the path to log directory LoginSystem string // "AesSrp" or "Basic" or "Un/Pw" ApiTable string // ApiList string // ApiStatus string // ApiTableKey string // If true (!= "") then this password will be requried to access /api/table calls. RedisApiTableKey string // If used (!= "") then lookup the password in redis using this as the prefix for the key. LimitPostJoinRows int // -1 indicates unlimited, default, 0 - is do not allow, N is maximum number of rows to post-join on get SendStatusOnError bool // if true will send back errors as a status_code, else will send "status"=="error" in JSON, code 200 DbSchema string // // 1. g_schema // xyzzy - should pull from config "public" DbCreateScript string // // 2. xyzzyPath1 // xyzzyPath1 - should pull from config ./table_ddl RedisSessionPrefix string // -- use the same namespace as SessionRedis! EmailConfigFileName string // name of file to take Email config from EmailTemplateDir string // KeyFilePrivate string // private key file for signing JWT tokens DisplayURL2fa string // 2fa - see X2faSetup RedisPrefix2fa string // 2fa - see X2faSetup Server2faURL string // 2fa see X2faSetup StatusForAllErrors string // if "yes" then on errors status will be returned and errors will be logged. if "no-use-JSON-msg" then status 200, with JSON message returned. Error is still logged. LineNo int // MuxAuto map[string]int // formerly global -- make private xyzzy -- // Config for automaic reload - to delete routes removed MuxAutoPass int // formerly global -- make private xyzzy -- // Config for automaic reload - to delete routes removed SQLCfg map[string]SQLOne // contains filtered or unexported fields }
func NewTabServer2Server ¶
func NewTabServer2Server(n http.Handler, Path []string, AppRoot []string, gCfg *cfg.ServerGlobalConfigType) (rv *TabServer2Type)
func (*TabServer2Type) BindPlaceholder ¶
func (hdlr *TabServer2Type) BindPlaceholder(n int) (rv string)
func (*TabServer2Type) CacheItForLater ¶
func (hdlr *TabServer2Type) CacheItForLater(res http.ResponseWriter, req *http.Request, h SQLOne, id string, theData string, h_Query string, data ...interface{})
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
func (*TabServer2Type) CacheItForLaterMk ¶
func (hdlr *TabServer2Type) CacheItForLaterMk(res http.ResponseWriter, req *http.Request, h SQLOne, theData string)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
func (*TabServer2Type) CallFunction ¶
func (hdlr *TabServer2Type) CallFunction(ba string, fx_name string, www http.ResponseWriter, req *http.Request, cfgTag string, rv string, isError bool, cookieList map[string]string, ps *goftlmux.Params, trx *tr.Trx) (string, PrePostFlagType, bool, int)
CallFunction will call a pre-post processing function. This is the palce where the PrePost constants will need to be handled. This function also reports to the log any attempts to call a non-existent function.
func (*TabServer2Type) CheckSqlCfgValid ¶
func (hdlr *TabServer2Type) CheckSqlCfgValid() (isOk bool)
func (*TabServer2Type) CommmonCrudPrefix ¶
func (hdlr *TabServer2Type) CommmonCrudPrefix(res http.ResponseWriter, req *http.Request, op string, ps *goftlmux.Params, rw *goftlmux.MidBuffer) (ok bool, mdata map[string]string, cfgTag string, h SQLOne, trx *tr.Trx, table_name string, wc *WhereCollect)
==================================================================================================================================================================== ====================================================================================================================================================================
func (*TabServer2Type) CommonLimitOffset ¶
func (hdlr *TabServer2Type) CommonLimitOffset(mdata map[string]string, data *[]interface{}, h SQLOne, table_name string, trx *tr.Trx, res http.ResponseWriter, req *http.Request, ps *goftlmux.Params) bool
=========================================================================================================================================================================
For MS SQL Server: From: https://technet.microsoft.com/en-us/library/gg699618(v=sql.110).aspx SELECT First Name + ' ' + Last Name FROM Employees ORDER BY First Name OFFSET 10 ROWS FETCH NEXT 5 ROWS ONLY; Test: http://192.168.0.161:8200/api/table/t_test_crud3?limit=3&offset=2 Test: http://192.168.0.161:8200/api/table/t_test_crud3?limit=3 Test: http://192.168.0.161:8200/api/table/t_test_crud3?offset=5 Oracle: My all-time-favorite use of ROWNUM is pagination. In this case, I use ROWNUM to get rows N through M of a result set. The general form is as follows: select * from ( select / *+ FIRST_ROWS(n) * / a.*, ROWNUM rnum from ( your_query_goes_here, with order by ) a where ROWNUM <= :MAX_ROW_TO_FETCH ) where rnum >= :MIN_ROW_TO_FETCH; Notes: From: http://www.oracle.com/technetwork/issue-archive/2006/06-sep/o56asktom-086197.html Test: http://192.168.0.154:8200/api/table/t_test_crud3?limit=3&offset=2 http://192.168.0.154:8200/api/table/t_test_crud3?limit=3 http://192.168.0.154:8200/api/table/t_test_crud3?offset=5
=========================================================================================================================================================================
func (*TabServer2Type) CommonWhereClause ¶
func (hdlr *TabServer2Type) CommonWhereClause(pkRequired bool, id string, idflag bool, mdata map[string]string, data *[]interface{}, h SQLOne, table_name string, trx *tr.Trx, wc *WhereCollect, res http.ResponseWriter, req *http.Request, ps *goftlmux.Params) (fail bool, isPk bool)
==================================================================================================================================================================== ====================================================================================================================================================================
func (*TabServer2Type) CreateMissingTable ¶
func (hdlr *TabServer2Type) CreateMissingTable(conn *sizlib.MyDb, tn string) (err error)
func (*TabServer2Type) CrudErrMsg ¶
func (hdlr *TabServer2Type) CrudErrMsg(depth int, msg string, err error, col string, trx *tr.Trx, res http.ResponseWriter, req *http.Request, ps *goftlmux.Params)
==================================================================================================================================================================== ====================================================================================================================================================================
func (*TabServer2Type) DbEnabledOn ¶
func (hdlr *TabServer2Type) DbEnabledOn(www http.ResponseWriter, s string) bool
xyzzy need hdlr func PickInsertUpdateColumns(www http.ResponseWriter, theFile0 map[string]interface{}, table_key string) (rv map[string]interface{}) {
func (*TabServer2Type) ExecSProcCmd ¶
func (hdlr *TabServer2Type) ExecSProcCmd(name string, np int) (rv string, err error)
func (*TabServer2Type) ExtendedWhereCaluse ¶
func (hdlr *TabServer2Type) ExtendedWhereCaluse(mdata map[string]string, h SQLOne, data *[]interface{}, trx *tr.Trx, wc *WhereCollect, res http.ResponseWriter, req *http.Request, ps *goftlmux.Params) (ok bool)
==================================================================================================================================================================== http://localhost:8090/api/table/t_email_q?where={%22op%22:%22and%22,%22List%22:[{%22op%22:%22=%22,%22name%22:%22to%22,%22val1s%22:%22pschlump@gmail.com%22},{%22op%22:%22=%22,%22name%22:%22status%22,%22val1s%22:%22pending%22}]} http://localhost:8090/api/table/t_email_q?where={"op":"and","List":[{"op":"=","name":"to","val1s":"pschlump@gmail.com"},{"op":"=","name":"status","val1s":"pending"}]} see l2/rt.go ====================================================================================================================================================================
func (*TabServer2Type) GenInsUpdInfo ¶
func (hdlr *TabServer2Type) GenInsUpdInfo(table_key string, jData map[string]interface{}, mdata map[string]string)
func (*TabServer2Type) GenInsertValues ¶
func (hdlr *TabServer2Type) GenInsertValues(h SQLOne, trx *tr.Trx, data *[]interface{}, mdata map[string]string, n_col int, res http.ResponseWriter, req *http.Request, ps *goftlmux.Params) (ok bool, s_id string)
==================================================================================================================================================================== ====================================================================================================================================================================
func (*TabServer2Type) GenKeyMk ¶
func (hdlr *TabServer2Type) GenKeyMk(h SQLOne, ps *goftlmux.Params) string
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
func (*TabServer2Type) GenOrderBy ¶
func (hdlr *TabServer2Type) GenOrderBy(mdata map[string]string, h SQLOne, trx *tr.Trx, res http.ResponseWriter, req *http.Request, ps *goftlmux.Params) bool
==============================================================================================================================================================================
Limits:
ColName can be 1..N of columns in h.Cols or the name of the column (case senstivie) Dir is ASC or DESC - case in-sensitive.
Example: ( " should be %22 )
http://localhost:8090/api/table/tblNotify?limit=5&orderBy=[{"ColName":"4","Dir":"desc"}]
Enhancement: Allow for sort by function or type cast. Enhancement: Sort by any leading edge of a key defined in d.b.
==============================================================================================================================================================================
func (*TabServer2Type) GenProjectedCols ¶
func (hdlr *TabServer2Type) GenProjectedCols(mdata map[string]string, h SQLOne, trx *tr.Trx, ps *goftlmux.Params)
============================================================================================================================================================================== Build the projected columns for selects. This is the SELECT <columns> section. ==============================================================================================================================================================================
func (*TabServer2Type) GenTemplate ¶
func (hdlr *TabServer2Type) GenTemplate(h SQLOne, op string, mdata map[string]string, wc *WhereCollect, data *[]interface{}, isCount bool, ps *goftlmux.Params) (string, error)
==================================================================================================================================================================== ====================================================================================================================================================================
func (*TabServer2Type) GenUpdateSet ¶
func (hdlr *TabServer2Type) GenUpdateSet(h SQLOne, trx *tr.Trx, data *[]interface{}, mdata map[string]string, res http.ResponseWriter, req *http.Request, ps *goftlmux.Params) bool
==================================================================================================================================================================== ====================================================================================================================================================================
func (*TabServer2Type) Get2MinHashFunc ¶
func (hdlr *TabServer2Type) Get2MinHashFunc() (hash string, ttlLeft int, err error)
func (*TabServer2Type) GetDataList ¶
func (hdlr *TabServer2Type) GetDataList(ty string, wc WhereClause, trx *tr.Trx, h SQLOne, bind *[]interface{}) (string, error)
Used in "in" or "not in" in where clause - where data is to be bound to a list of values.
func (*TabServer2Type) GetDbType ¶
func (hdlr *TabServer2Type) GetDbType() DbType
return the type of the database --
func (*TabServer2Type) GetFunctionInformationSchema ¶
func (hdlr *TabServer2Type) GetFunctionInformationSchema(conn *sizlib.MyDb, FunctionName string, Params []string) (rv DbTableType, err error)
SELECT routines.routine_name, parameters.data_type, parameters.ordinal_position FROM information_schema.routines
JOIN information_schema.parameters ON routines.specific_name=parameters.specific_name
WHERE routines.specific_schema='public' ORDER BY routines.routine_name, parameters.ordinal_position;
func (*TabServer2Type) GetPkName ¶
func (hdlr *TabServer2Type) GetPkName(h SQLOne, nPkCols int, trx *tr.Trx, res http.ResponseWriter, req *http.Request, ps *goftlmux.Params) ([]string, bool)
============================================================================================================================================================================== Get the list of column names that form the primary key for the table in the h.Cols order. ==============================================================================================================================================================================
func (*TabServer2Type) GetRedisKey ¶
func (hdlr *TabServer2Type) GetRedisKey(key string) (rv string, err error)
func (*TabServer2Type) GetStoredProcedurePlist ¶
func (hdlr *TabServer2Type) GetStoredProcedurePlist(np int) (rv string)
,"/api/test/register_new_user": { "g": "test_register_new_user($1,$2,$3,$4,$5,$6,$7,$8,$9)", "p": [ "username", "password", "$ip$", "email", "real_name", "$url$", "csrf_token", "site", "name" ],
for ".G" - use "P" parameters and GetStoredProcedurePlist - so...
PostgreSQL - ($1,$2...$n) ODBC " "?,?,... nof them Oracle (:p1,:p2...:pN)
func (*TabServer2Type) GetTableInformationSchema ¶
func (hdlr *TabServer2Type) GetTableInformationSchema(conn *sizlib.MyDb, TableName string) (rv DbTableType, err error)
func (*TabServer2Type) GetUserIDFromAuthToken ¶
func (hdlr *TabServer2Type) GetUserIDFromAuthToken(auth_token string) (user_id string, err error)
------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------
func (*TabServer2Type) GetValidList ¶
func (hdlr *TabServer2Type) GetValidList(user_id string) (list []string, err error)
------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------ GetValidList get list of convened to string int values for valid 2fa
func (*TabServer2Type) HasPKInWhere ¶
func (hdlr *TabServer2Type) HasPKInWhere(mdata map[string]string, h SQLOne, trx *tr.Trx, res http.ResponseWriter, req *http.Request, ps *goftlmux.Params) (hasPk bool)
=================================================================================================================================================== ===================================================================================================================================================
func (*TabServer2Type) HaveCachedData ¶
func (hdlr *TabServer2Type) HaveCachedData(res http.ResponseWriter, req *http.Request, h SQLOne, h_Query string, data ...interface{}) (rv string, found bool)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
func (*TabServer2Type) HaveCachedDataMk ¶
func (hdlr *TabServer2Type) HaveCachedDataMk(res http.ResponseWriter, req *http.Request, h SQLOne) (data string, found bool)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
func (*TabServer2Type) InitializeWithConfigData ¶
func (hdlr *TabServer2Type) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)
func (*TabServer2Type) PickInsertUpdateColumns ¶
func (hdlr *TabServer2Type) PickInsertUpdateColumns(www http.ResponseWriter, theFile0 map[string]interface{}, table_key string) (rv map[string]interface{})
==============================================================================================================================================================================
theFile0 = pickInsertUpdate ( theFile0, "table:img_file" ) // xyzzy f(x)
test: t-pp1.go ============================================================================================================================================================================== xyzzy -- depricated -- I don't think this function is called at all --
func (*TabServer2Type) PreValidate ¶
func (hdlr *TabServer2Type) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)
func (*TabServer2Type) ProcessErrors ¶
func (*TabServer2Type) PullQRURLFromDB ¶
func (hdlr *TabServer2Type) PullQRURLFromDB() (qr_enc_id, qr_url string, err error)
qrId, QRImgUrl, err = hdlr.PullQRURLFromDB() err = hdlr.PullQRFromDB(rr.Tag)
func (*TabServer2Type) RemapParams ¶
func (*TabServer2Type) RespHandlerRedis ¶
func (hdlr *TabServer2Type) RespHandlerRedis(res http.ResponseWriter, req *http.Request, cfgTag string, ps *goftlmux.Params, rw *goftlmux.MidBuffer)
============================================================================================================================================================================== Redis Keys Do we need a "prefix" or a "table" type thing to limit access to a set of keys? ==============================================================================================================================================================================
func (*TabServer2Type) RespHandlerSQL ¶
func (hdlr *TabServer2Type) RespHandlerSQL(res http.ResponseWriter, req *http.Request, cfgTag string, ps *goftlmux.Params, rw *goftlmux.MidBuffer)
============================================================================================================================================================================== ==============================================================================================================================================================================
func (*TabServer2Type) ServeHTTP ¶
func (hdlr *TabServer2Type) ServeHTTP(www http.ResponseWriter, req *http.Request)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
func (*TabServer2Type) TemplateEmail ¶
func (hdlr *TabServer2Type) TemplateEmail(template_name string, mdata map[string]string) (s1, b1, b2 string, err error)
s1, b1, s2, b2, err := TemplateEmail ( ed.Email["template"], ed )
func (*TabServer2Type) UpdateQRMarkAsUsed ¶
func (hdlr *TabServer2Type) UpdateQRMarkAsUsed(qrId string) error
func (*TabServer2Type) ValidateUserTrx ¶
type Validation ¶
type Validation struct { Required bool Type string Min_len int Max_len int Min int64 Max int64 MinF float64 MaxF float64 MinD time.Time MaxD time.Time Default string UrlEncode bool ReMatch string ChkType bool // contains filtered or unexported fields }
-------------------------------------------------- New -------------------------------------------------- test: t-pp1.go
type ValidationIn ¶
type WhereClause ¶
type WhereCollect ¶
type WhereCollect struct {
AClause []string
}
func NewWhereCollect ¶
func NewWhereCollect() *WhereCollect
func (*WhereCollect) AddClause ¶
func (this *WhereCollect) AddClause(s string)
func (*WhereCollect) GenWhereClause ¶
func (this *WhereCollect) GenWhereClause(mdata map[string]string)
Source Files
¶
- AfterPasswordChange.go
- CachEUser.go
- ConvertErrorToCode.go
- CreateJWTToken.go
- DeCacheEUser.go
- DumpRV.go
- PubEMailToSend.go
- RedirectTo.go
- SendEmailMessage.go
- SendEmailToGenMessage.go
- SendReportsToGenMessage.go
- Sleep.go
- X2faSetup.go
- X2faStash.go
- aws_email_relay.go
- base2.go
- crud.go
- crud2.go
- crud4.go
- gen_ran.go
- lib.go
- lst.go
- pre-post.go
- process-errors.go
- table_ops.go
- ts2_ftl.go