Documentation ¶
Index ¶
- Constants
- Variables
- func Connect1(user, pass, host, dbName string, port, maxConn int) *pgxpool.Pool
- func GenInsert(table string, kvparams M.SX) (string, []any)
- func GenUpdateId(table string, id int64, kvparams M.SX) (string, []any)
- func GenUpdateWhere(table, where string, kvparams M.SX) (string, []any)
- func InitFunctions(conn *RDBMS)
- func InitOfficeMail(suffix string)
- func RamDel_ByQuery(ram_key, query string)
- func RamExpired_ByBucket_ByKey(bucket, ram_key string) bool
- func RamGetAI(ram_key, query string) ([]int64, bool)
- func RamGetAMSX(ram_key, query string) (A.MSX, bool)
- func RamGetAS(ram_key, query string) ([]string, bool)
- func RamGetBool(ram_key, query string) (bool, bool)
- func RamGetFloat(ram_key, query string) (float64, bool)
- func RamGetInt(ram_key, query string) (int64, bool)
- func RamGetMIS(ram_key, query string) (M.IS, bool)
- func RamGetMSS(ram_key, query string) (M.SS, bool)
- func RamGetMSX(ram_key, query string) (M.SX, bool)
- func RamGetStr(ram_key, query string) (string, bool)
- func RamGet_ByRamKey_ByQuery(ram_key, query string) any
- func RamGlobalEvict_ByAjax_ByBucket(ajax W.Ajax, bucket string)
- func RamGlobalEvict_ByBucket(bucket string)
- func RamSetAI(bucket, key, query string, val []int64, sec int64) []int64
- func RamSetAMSX(bucket, key, query string, val A.MSX, sec int64) A.MSX
- func RamSetAS(bucket, key, query string, val []string, sec int64) []string
- func RamSetBool(bucket, key, query string, val bool, sec int64) bool
- func RamSetFloat(bucket, key, query string, val float64, sec int64) float64
- func RamSetInt(bucket, key, query string, val int64, sec int64) int64
- func RamSetMIS(bucket, key, query string, val M.IS, sec int64) M.IS
- func RamSetMSS(bucket, key, query string, val M.SS, sec int64) M.SS
- func RamSetMSX(bucket, ram_key, query string, val M.SX, sec int64) M.SX
- func RamSetStr(bucket, key, query string, val string, sec int64) string
- func RamSet_ByBucket_ByRamKey_ByQuery(bucket, ram_key, query string, val any, sec int64)
- type Adapter
- type Base
- func (b *Base) DataToMap() M.SX
- func (b *Base) Delete(actor int64) bool
- func (b *Base) GetArr(key string) []any
- func (b *Base) GetBool(key string) bool
- func (b *Base) GetFloat(key string) float64
- func (b *Base) GetId() int64
- func (b *Base) GetInt(key string) int64
- func (b *Base) GetMSX(key string) M.SX
- func (b *Base) GetStr(key string) string
- func (b *Base) GetUniqueId() string
- func (b *Base) MapToData() string
- func (b *Base) Restore(actor int64) bool
- func (b *Base) Save(actor int64) bool
- func (b *Base) SetVal(key string, val any)
- type FieldModel
- type PgDockerTest
- func (in *PgDockerTest) ConnectCheck(res *dockertest.Resource) (conn *pgx.Conn, err error)
- func (in *PgDockerTest) Image96(pool *D.DockerTest) *dockertest.RunOptions
- func (in *PgDockerTest) ImageLatest(pool *D.DockerTest) *dockertest.RunOptions
- func (in *PgDockerTest) ImageVersion(pool *D.DockerTest, version string) *dockertest.RunOptions
- func (in *PgDockerTest) SetDefaults(img string)
- type PostgreSession
- func (sess PostgreSession) Del(key string)
- func (sess PostgreSession) Expiry(key string) int64
- func (sess PostgreSession) FadeInt(key string, val int64, sec int64)
- func (sess PostgreSession) FadeMSX(key string, val M.SX, sec int64)
- func (sess PostgreSession) FadeStr(key, val string, sec int64)
- func (sess PostgreSession) FadeVal(key string, val any, sec int64)
- func (sess PostgreSession) GetInt(key string) int64
- func (sess PostgreSession) GetMSX(key string) M.SX
- func (sess PostgreSession) GetStr(key string) string
- func (sess PostgreSession) Inc(key string) (ival int64)
- func (sess PostgreSession) Product() string
- func (sess PostgreSession) SetInt(key string, val int64)
- func (sess PostgreSession) SetMSX(key string, val M.SX)
- func (sess PostgreSession) SetStr(key, val string)
- func (sess PostgreSession) SetVal(key string, val any)
- type QueryParams
- type RDBMS
- func (db *RDBMS) CQBool(bucket, ram_key, query string) bool
- func (db *RDBMS) CQFirstMap(bucket, ram_key, query string) M.SX
- func (db *RDBMS) CQFloat(bucket, ram_key, query string) float64
- func (db *RDBMS) CQInt(bucket, ram_key, query string) int64
- func (db *RDBMS) CQIntArr(bucket, ram_key, query string) []int64
- func (db *RDBMS) CQIntStrMap(bucket, ram_key, query string) map[int64]string
- func (db *RDBMS) CQMapArray(bucket, ram_key, query string) A.MSX
- func (db *RDBMS) CQStr(bucket, ram_key, query string) string
- func (db *RDBMS) CQStrArr(bucket, ram_key, query string) []string
- func (db *RDBMS) CQStrMapMap(bucket, ram_key, index, query string) M.SX
- func (db *RDBMS) CQStrStrMap(bucket, ram_key, query string) map[string]string
- func (db *RDBMS) CTQBool(ttl int64, bucket, ram_key, query string) bool
- func (db *RDBMS) CTQFirstMap(ttl int64, bucket, ram_key, query string) M.SX
- func (db *RDBMS) CTQFloat(ttl int64, bucket, ram_key, query string) float64
- func (db *RDBMS) CTQInt(ttl int64, bucket, ram_key, query string) int64
- func (db *RDBMS) CTQIntArr(ttl int64, bucket, ram_key, query string) []int64
- func (db *RDBMS) CTQIntStrMap(ttl int64, bucket, ram_key, query string) map[int64]string
- func (db *RDBMS) CTQMapArray(ttl int64, bucket, ram_key, query string) A.MSX
- func (db *RDBMS) CTQStr(ttl int64, bucket, ram_key, query string) string
- func (db *RDBMS) CTQStrArr(ttl int64, bucket, ram_key, query string) []string
- func (db *RDBMS) CTQStrMapMap(ttl int64, bucket, ram_key, index, query string) M.SX
- func (db *RDBMS) CTQStrStrMap(ttl int64, bucket, ram_key, query string) map[string]string
- func (db *RDBMS) CreateBaseTable(name, users_table string)
- func (db *RDBMS) DoDelete(actor int64, table string, id int64) (ok bool)
- func (db *RDBMS) DoDelete2(actor int64, table string, id int64, lambda func(base D.Record) string, ...) bool
- func (db *RDBMS) DoInsert(actor int64, table string, kvparams M.SX) (id int64)
- func (db *RDBMS) DoRestore(actor int64, table string, id int64) (ok bool)
- func (db *RDBMS) DoRestore2(actor int64, table string, id int64, lambda func(base D.Record) string, ...) bool
- func (db *RDBMS) DoTransaction(lambda func(tx *Tx) string)
- func (db *RDBMS) DoUpdate(actor int64, table string, id int64, kvparams M.SX) (ra int64)
- func (db *RDBMS) DoUpsert(actor int64, table string, kvparams M.SX) (id int64)
- func (db *RDBMS) DoWipeUnwipe(a string, actor int64, table string, id int64) bool
- func (db *RDBMS) FixSerialSequence(table string)
- func (db *RDBMS) InitTrigger()
- func (db *RDBMS) JsonRow(table string, id int64, lambda func(rec D.Record) string) W.Ajax
- func (db *RDBMS) QAll(query string, params ...any) (rows Records)
- func (db *RDBMS) QArray(query string, params ...any) A.X
- func (db *RDBMS) QBase(table string, id int64) (base Base)
- func (db *RDBMS) QBaseUniq(table, uid string) (base Base)
- func (db *RDBMS) QBool(query string, params ...any) (dest bool)
- func (db *RDBMS) QCount(query string) (dest int64)
- func (db *RDBMS) QExists(table string, id int64) (ex bool)
- func (db *RDBMS) QFirstArray(query string, params ...any) A.X
- func (db *RDBMS) QFirstMap(query string, params ...any) M.SX
- func (db *RDBMS) QFloat(query string, params ...any) (dest float64)
- func (db *RDBMS) QId(table, key string) (id int64)
- func (db *RDBMS) QInt(query string, params ...any) (dest int64)
- func (db *RDBMS) QIntArr(query string, params ...any) []int64
- func (db *RDBMS) QIntBoolMap(query string, params ...any) M.IB
- func (db *RDBMS) QIntCountMap(query string, params ...any) M.II
- func (db *RDBMS) QIntIntMap(query string, params ...any) M.II
- func (db *RDBMS) QIntStr(query string, params ...any) (i int64, s string)
- func (db *RDBMS) QIntStrMap(query string, params ...any) M.IS
- func (db *RDBMS) QJsonIntArr(query string, params ...any) []int64
- func (db *RDBMS) QMapArray(query string, params ...any) A.MSX
- func (db *RDBMS) QStr(query string, params ...any) (dest string)
- func (db *RDBMS) QStrArr(query string, params ...any) []string
- func (db *RDBMS) QStrArrMap(query string, params ...any) M.SAX
- func (db *RDBMS) QStrBoolMap(query string, params ...any) M.SB
- func (db *RDBMS) QStrCountMap(query string, params ...any) M.SI
- func (db *RDBMS) QStrIdxArrMap(key_idx int64, query string, params ...any) M.SAX
- func (db *RDBMS) QStrInt(query string, params ...any) (s string, i int64)
- func (db *RDBMS) QStrIntMap(query string, params ...any) M.SI
- func (db *RDBMS) QStrMapMap(key_idx string, query string, params ...any) M.SX
- func (db *RDBMS) QStrShiftArrMap(query string, params ...any) M.SAX
- func (db *RDBMS) QStrStr(query string, params ...any) (s string, ss string)
- func (db *RDBMS) QStrStrMap(query string, params ...any) M.SS
- func (db *RDBMS) QTsv(header, query string, params ...any) bytes.Buffer
- func (db *RDBMS) QUniq(table string, key int64) (uniq string)
- func (db *RDBMS) RenameBaseTable(oldname, newname string)
- func (db *RDBMS) TableExists(tableName string) bool
- func (db *RDBMS) ViewExists(viewname string) bool
- type Records
- func (r *Records) Close()
- func (r *Records) Err() error
- func (r *Records) ErrorCheck(err error, msg string)
- func (r *Records) Next() bool
- func (r *Records) Scan(dest ...any) bool
- func (r *Records) ScanMap() map[string]any
- func (r *Records) ScanSlice() []any
- func (r *Records) ScanStruct(dest any) bool
- type Row
- func (mp *Row) Check_UserPassword(pass string) bool
- func (mp *Row) Delete()
- func (mp *Row) GetAX(key string) []any
- func (mp *Row) GetBool(key string) bool
- func (mp *Row) GetFloat(key string) float64
- func (mp *Row) GetInt(key string) int64
- func (mp *Row) GetStr(key string) string
- func (mp *Row) Get_Id() int64
- func (mp *Row) Get_UniqueId() string
- func (mp *Row) IndateRow() int64
- func (mp *Row) InsertRow() int64
- func (mp *Row) IsChanged() bool
- func (mp *Row) LogIt(key string, val any)
- func (mp *Row) LogNonData(key string, val any)
- func (mp *Row) NotLogIt(key string, val any)
- func (mp *Row) PermanentErase()
- func (mp *Row) Restore()
- func (mp *Row) SetBool(key string) bool
- func (mp *Row) SetFloat(key string) float64
- func (mp *Row) SetInt(key string) int64
- func (mp *Row) SetIntlPhone(key string) string
- func (mp *Row) SetJsonIntArr(key string) []int64
- func (mp *Row) SetJsonMap(key string) M.SX
- func (mp *Row) SetJsonObjArr(key string) []map[string]any
- func (mp *Row) SetJsonStrArr(key string) []string
- func (mp *Row) SetNonData(key string)
- func (mp *Row) SetNonDataVal(key string, val any)
- func (mp *Row) SetStr(key string) string
- func (mp *Row) SetStrPhone(key string) string
- func (mp *Row) SetType(val string) string
- func (mp *Row) SetUnsetClock(key string) string
- func (mp *Row) SetUnsetIntVal(key string, val int64) int64
- func (mp *Row) SetUnsetValClock(key string, val string) string
- func (mp *Row) SetVal(key string, val any) any
- func (mp *Row) SetValEpoch(key string) float64
- func (mp *Row) SetValEpochOnce(key string) float64
- func (mp *Row) SetValIf(ok bool, key string, val any)
- func (mp *Row) SetValNoXSS(key string, val any) any
- func (mp *Row) SetValOnce(key string, val any) any
- func (mp *Row) SetValStr(key, val string)
- func (mp *Row) Set_UniqueId(val string)
- func (mp *Row) Set_UserEmails(emails string) (ok bool)
- func (mp *Row) Set_UserEmails_ByTable(emails string, table string) (ok bool)
- func (mp *Row) Set_UserPassword(pass string)
- func (mp *Row) ToJson() string
- func (mp *Row) Unset(key string)
- func (mp *Row) UpdateRow() int64
- func (mp *Row) UpsertRow() int64
- func (mp *Row) WipeUnwipe(a string)
- type TableModel
- func (tm *TableModel) FieldModel_ByKey(name string) FieldModel
- func (tm *TableModel) FormFields() A.MSX
- func (tm *TableModel) GridFields() A.MSX
- func (tm *TableModel) JoinStr() string
- func (tm *TableModel) Query(table, ram_key string) string
- func (tm *TableModel) Select() string
- func (tm *TableModel) SelectNoJoin() string
- type Tx
- func (tx *Tx) DataJsonMapIdAndIsDeleted_ByUniq(table, unique_id string) (res M.SX, id int64, is_deleted bool)
- func (tx *Tx) DataJsonMapUniqAndIsDeleted_ById(table string, id int64) (res M.SX, uniq string, is_deleted bool)
- func (tx *Tx) DoDelete(actor int64, table string, id int64) bool
- func (tx *Tx) DoDelete2(actor int64, table string, id int64, lambda func(base *Base) string, ...) bool
- func (tx *Tx) DoExec(query string, params ...any) sql.Result
- func (tx *Tx) DoForcedInsert(actor int64, table string, kvparams M.SX) (id int64)
- func (tx *Tx) DoInsert(actor int64, table string, kvparams M.SX) (id int64)
- func (tx *Tx) DoRestore(actor int64, table string, id int64) bool
- func (tx *Tx) DoRestore2(actor int64, table string, id int64, lambda func(base *Base) string, ...) bool
- func (tx *Tx) DoUpdate(actor int64, table string, id int64, kvparams M.SX) (ra int64)
- func (tx *Tx) DoUpsert(actor int64, table string, kvparams M.SX) (id int64)
- func (tx *Tx) DoWipeUnwipe(a string, actor int64, table string, id int64) bool
- func (tx *Tx) QAll(query string, params ...any) (rows Records)
- func (tx *Tx) QBase(table string, id int64) (base Base)
- func (tx *Tx) QBaseUniq(table, uid string) (base Base)
- func (tx *Tx) QExists(table string, id int64) bool
- func (tx *Tx) QFirstMap(query string, params ...any) M.SX
- func (tx *Tx) QFloat(query string, params ...any) (dest float64)
- func (tx *Tx) QId(table, uniq string) (id int64)
- func (tx *Tx) QInt(query string, params ...any) (dest int64)
- func (tx *Tx) QIntArr(query string, params ...any) []int64
- func (tx *Tx) QIntBoolMap(query string, params ...any) M.IB
- func (tx *Tx) QIntCountMap(query string, params ...any) M.II
- func (tx *Tx) QIntIntMap(query string, params ...any) M.II
- func (tx *Tx) QIntStr(query string, params ...any) (i int64, s string)
- func (tx *Tx) QIntStrMap(query string, params ...any) M.IS
- func (tx *Tx) QJsonIntArr(query string, params ...any) []int64
- func (tx *Tx) QStr(query string, params ...any) (dest string)
- func (tx *Tx) QStrArr(query string, params ...any) []string
- func (tx *Tx) QStrArrMap(query string, params ...any) M.SAX
- func (tx *Tx) QStrBoolMap(query string, params ...any) M.SB
- func (tx *Tx) QStrCountMap(query string, params ...any) M.SI
- func (tx *Tx) QStrInt(query string, params ...any) (s string, i int64)
- func (tx *Tx) QStrIntMap(query string, params ...any) M.SI
- func (tx *Tx) QStrStr(query string, params ...any) (s string, ss string)
- func (tx *Tx) QStrStrMap(query string, params ...any) M.SS
- func (tx *Tx) QUniq(table string, id int64) (uniq string)
Constants ¶
const ROWS_MAX_LIMIT = 2000
const SQL_FUNCTIONS = `` /* 3327-byte string literal not displayed */
const TTL = 3
Variables ¶
var CACHE *cmap.CMap // cache real storage
var CACHE_BORN *cmap.CMap // cache born time
var CACHE_INV *cmap.CMap // table invalidate date
var CACHE_TTL *cmap.CMap // cache invalidate time
var DEBUG bool
var FORM_CACHE *cmap.CMap // cache form fields
var GRID_CACHE *cmap.CMap // cache grid fields
var OFFICE_MAIL_SUFFIX string
var SELECT_CACHE *cmap.CMap
var SELECT_NOJOIN_CACHE *cmap.CMap
var SESSION_DBACTOR_ID = int64(1)
var SESSION_EXPIRY_KEY = `expired_at`
var SESSION_VALUE_KEY = `value`
var TYPE_CACHE *cmap.CMap // cache key-type (M.SS)
var Z func(string) string
var ZI func(int64) string
var ZJ func(string) string
var ZJLIKE func(string) string
var ZLIKE func(string) string
var ZS func(string) string
var ZZ func(string) string
Functions ¶
func GenUpdateId ¶
generate update, requires table name, id and field-value params
func GenUpdateWhere ¶
generate update, requires table, id and
func InitFunctions ¶
func InitFunctions(conn *RDBMS)
func InitOfficeMail ¶
func InitOfficeMail(suffix string)
func RamDel_ByQuery ¶
func RamDel_ByQuery(ram_key, query string)
func RamGetBool ¶
func RamGetFloat ¶
func RamGet_ByRamKey_ByQuery ¶
returns false when cache expired
func RamGlobalEvict_ByBucket ¶
func RamGlobalEvict_ByBucket(bucket string)
func RamSetAMSX ¶
A.MSX only set when not yet being set, preventing double write and double delete
func RamSetBool ¶
BOOL only set when not yet being set, preventing double write and double delete
func RamSetFloat ¶
FLOAT64 only set when not yet being set, preventing double write and double delete
func RamSetMIS ¶
MAP[INT64]STRING only set when not yet being set, preventing double write and double delete
func RamSetMSS ¶
MAP[STRING]STRING only set when not yet being set, preventing double write and double delete
Types ¶
type Base ¶
type Base struct { Id int64 `db:"id"` Table string Connection *RDBMS UniqueId sql.NullString `db:"unique_id"` CreatedAt pq.NullTime `db:"created_at"` UpdatedAt pq.NullTime `db:"updated_at"` DeletedAt pq.NullTime `db:"deleted_at"` RestoredAt pq.NullTime `db:"restored_at"` ModifiedAt pq.NullTime `db:"modified_at"` CreatedBy sql.NullInt64 `db:"created_by"` UpdatedBy sql.NullInt64 `db:"updated_by"` DeletedBy sql.NullInt64 `db:"deleted_by"` RestoredBy sql.NullInt64 `db:"restored_by"` IsDeleted bool `db:"is_deleted"` DataStr string `db:"data"` // json object XData M.SX }
base structure for all model, including schema
type FieldModel ¶
type FieldModel struct { Label string // label in form, and grid HtmlLabel string // label for both form and grid FormLabel string // label in form GridLabel string // label in grid FormTooltip string // placeholder in form Key string // key in the table.data Type string // for formatting sql, form, and grid: float2, integer, datetime SqlType string // for overriding sql format: bigint, float FormType string // for overriding form format GridType string // for overriding grid format HtmlSubType string // for checkbox example: 'True':'False', for select: DS.DataSourceName Hide bool // for hiding in sql, form, and grid SqlHide bool // for overriding sql hide status HtmlHide bool // for hiding both form and grid FormHide bool // for overriding form hide status GridHide bool // for overriding grid hide status Required bool CustomQuery string Default string // default value Min string // minimum value Max string // maximum value SqlColPos int // position on SQL Select NotDataCol bool // is it data->>'col_name' (default) or .col_name (true), overriden by: id, is_deleted, unique_id, modified_*, created_*, deleted_*, restored_*, updated_* where * = at or by }
func (*FieldModel) SqlColumn ¶
func (field *FieldModel) SqlColumn() string
type PgDockerTest ¶
type PgDockerTest struct { User string Password string Database string Image string Port string DSN string // contains filtered or unexported fields }
func (*PgDockerTest) ConnectCheck ¶
func (in *PgDockerTest) ConnectCheck(res *dockertest.Resource) (conn *pgx.Conn, err error)
func (*PgDockerTest) Image96 ¶
func (in *PgDockerTest) Image96(pool *D.DockerTest) *dockertest.RunOptions
func (*PgDockerTest) ImageLatest ¶
func (in *PgDockerTest) ImageLatest(pool *D.DockerTest) *dockertest.RunOptions
func (*PgDockerTest) ImageVersion ¶
func (in *PgDockerTest) ImageVersion(pool *D.DockerTest, version string) *dockertest.RunOptions
func (*PgDockerTest) SetDefaults ¶
func (in *PgDockerTest) SetDefaults(img string)
type PostgreSession ¶
func NewSession ¶
func NewSession(conn *RDBMS, table, users_table string) *PostgreSession
func (PostgreSession) Del ¶
func (sess PostgreSession) Del(key string)
func (PostgreSession) Expiry ¶
func (sess PostgreSession) Expiry(key string) int64
func (PostgreSession) FadeInt ¶
func (sess PostgreSession) FadeInt(key string, val int64, sec int64)
func (PostgreSession) FadeStr ¶
func (sess PostgreSession) FadeStr(key, val string, sec int64)
func (PostgreSession) GetInt ¶
func (sess PostgreSession) GetInt(key string) int64
func (PostgreSession) GetStr ¶
func (sess PostgreSession) GetStr(key string) string
func (PostgreSession) Inc ¶
func (sess PostgreSession) Inc(key string) (ival int64)
func (PostgreSession) Product ¶
func (sess PostgreSession) Product() string
func (PostgreSession) SetInt ¶
func (sess PostgreSession) SetInt(key string, val int64)
func (PostgreSession) SetStr ¶
func (sess PostgreSession) SetStr(key, val string)
func (PostgreSession) SetVal ¶
func (sess PostgreSession) SetVal(key string, val any)
type QueryParams ¶
type QueryParams struct { Term string Offset int64 Limit int64 Count int64 Order []string Rows A.MSX Filter M.SX Model *TableModel IsDefault bool WithAs string Where string Select string RamKey string From string Join string OrderBy string }
2017-01-25 Prayogo
func NewQueryParams ¶
func NewQueryParams(posts *W.Posts, model *TableModel) *QueryParams
func (*QueryParams) SearchQuery_ByConn ¶
func (qp *QueryParams) SearchQuery_ByConn(conn *RDBMS)
func (*QueryParams) ToAjax ¶
func (qp *QueryParams) ToAjax(ajax W.Ajax)
func (*QueryParams) ToMSX ¶
func (qp *QueryParams) ToMSX(m M.SX)
type RDBMS ¶
wrapper for GO's sql.DB
func (*RDBMS) CQFirstMap ¶
query and cache M.SX for TTL seconds
func (*RDBMS) CQIntStrMap ¶
query and cache map[int64]string for TTL seconds
func (*RDBMS) CQMapArray ¶
query and cache AMSX for TTL seconds
func (*RDBMS) CQStrMapMap ¶
query and cache M.SX for TTL seconds
func (*RDBMS) CQStrStrMap ¶
query and cache map[string]string for TTL seconds
func (*RDBMS) CTQFirstMap ¶
query and cache M.SX for TTL seconds
func (*RDBMS) CTQIntStrMap ¶
query and cache map[int64]string for TTL seconds
func (*RDBMS) CTQMapArray ¶
query and cache AMSX for TTL seconds
func (*RDBMS) CTQStrMapMap ¶
query and cache M.SX for TTL seconds
func (*RDBMS) CTQStrStrMap ¶
query and cache map[string]string for TTL seconds
func (*RDBMS) CreateBaseTable ¶
create a base table
func (*RDBMS) DoDelete2 ¶
func (db *RDBMS) DoDelete2(actor int64, table string, id int64, lambda func(base D.Record) string, ajax W.Ajax) bool
execute delete (is_deleted = true)
func (*RDBMS) DoRestore2 ¶
func (db *RDBMS) DoRestore2(actor int64, table string, id int64, lambda func(base D.Record) string, ajax W.Ajax) bool
execute delete (is_deleted = false)
func (*RDBMS) DoTransaction ¶
begin, commit transaction and rollback automatically when there are error
func (*RDBMS) DoWipeUnwipe ¶
delete or restore
func (*RDBMS) FixSerialSequence ¶
reset sequence, to be called after TRUNCATE TABLE tablename
func (*RDBMS) JsonRow ¶
2015-12-04 Kiz: replacement for JsonLine lambda should return empty string if it's correct row
func (*RDBMS) QArray ¶
query any number of columns, returns array of slice (to be exported directly to json, not for processing)
func (*RDBMS) QFirstArray ¶
query any number of columns, returns first line of line
func (*RDBMS) QIntBoolMap ¶
query single column int64, return with true value
func (*RDBMS) QIntCountMap ¶
query 1 colums of integer as map
func (*RDBMS) QIntIntMap ¶
query 2 colums of integer-integer as map SELECT id, COUNT(*)
func (*RDBMS) QIntStrMap ¶
query 2 colums of integer-string as map SELECT id, unique_id
func (*RDBMS) QJsonIntArr ¶
query one cell [1,2,3,...] and return array of int64
func (*RDBMS) QMapArray ¶
query any number of columns, returns array of slice (to be exported directly to json, not for processing)
func (*RDBMS) QStrArrMap ¶
query 1+N columns of string-[]any as map
func (*RDBMS) QStrBoolMap ¶
query 1 colums of string as map SELECT unique_id
func (*RDBMS) QStrCountMap ¶
query 1 colums of string as map result equal to: SELECT name, COUNT(*) FROM tabel1 GROUP BY 1 map[string]int
func (*RDBMS) QStrIdxArrMap ¶
query any number of columns, returns map of string, array (to be exported directly to json, not for processing) the key_idx will be converted to string and taken as key
func (*RDBMS) QStrIntMap ¶
query 2 colums of string-integer as map
func (*RDBMS) QStrMapMap ¶
query any number of columns, returns map of string, map (to be exported directly to json, not for processing) the key_idx will be converted to string and taken as key
func (*RDBMS) QStrShiftArrMap ¶
query any number of columns, returns map of string, array (to be exported directly to json, not for processing) the first index will be converted to string and taken as key
func (*RDBMS) QStrStrMap ¶
query 2 colums of string-string as map
func (*RDBMS) RenameBaseTable ¶
rename a base table
func (*RDBMS) TableExists ¶
func (*RDBMS) ViewExists ¶
type Row ¶
type Row struct { Row M.SX NonData M.SX Posts *W.Posts Ajax W.Ajax ReqModel *W.RequestModel Table string Id int64 Tx *Tx DbActor int64 Log string UniqueId string // set when you want to update it IsDeleted bool }
primary table model
func NewNonDataRow ¶
func NewNonDataRow(tx *Tx, table string, rm *W.RequestModel) *Row
create empty model
func NewRowUniq ¶
fetch model to be edited from unique
func (*Row) IndateRow ¶
insert or update row, insert if not exists even when uinque_id exists (error)
func (*Row) SetIntlPhone ¶
set international phone, format: +xx xxxxxx
func (*Row) SetJsonIntArr ¶
set Row from json int[]
func (*Row) SetJsonObjArr ¶
set Row from json object[]
func (*Row) SetJsonStrArr ¶
set Row from json string[]
func (*Row) SetNonData ¶
func (*Row) SetStrPhone ¶
set string strip prefix and suffix from and letters
func (*Row) SetUnsetClock ¶
set time from Posts to Row unset when string is whitespace
func (*Row) SetUnsetIntVal ¶
set unset int, returns 0 when unsetted
func (*Row) SetUnsetValClock ¶
set time hh:mm
func (*Row) SetValEpoch ¶
set Row by current date epoch as float
func (*Row) SetValEpochOnce ¶
set Row by current date epoch as float
func (*Row) SetValNoXSS ¶
set val without XSS filtering
func (*Row) SetValOnce ¶
set Row value only if still empty, or never being saved
func (*Row) Set_UserEmails ¶
set Row office_mail, gmail, yahoo and email
func (*Row) Set_UserEmails_ByTable ¶
func (*Row) Set_UserPassword ¶
set user password, skip logging
type TableModel ¶
type TableModel struct { CacheName string Fields []FieldModel Joins string WithAs string }
func (*TableModel) FieldModel_ByKey ¶
func (tm *TableModel) FieldModel_ByKey(name string) FieldModel
get type of a field by key
func (*TableModel) JoinStr ¶
func (tm *TableModel) JoinStr() string
func (*TableModel) Query ¶
func (tm *TableModel) Query(table, ram_key string) string
func (*TableModel) SelectNoJoin ¶
func (tm *TableModel) SelectNoJoin() string
generate select fields without join
type Tx ¶
func (*Tx) DataJsonMapIdAndIsDeleted_ByUniq ¶
func (tx *Tx) DataJsonMapIdAndIsDeleted_ByUniq(table, unique_id string) (res M.SX, id int64, is_deleted bool)
fecth json data as map by unique id
func (*Tx) DataJsonMapUniqAndIsDeleted_ById ¶
func (tx *Tx) DataJsonMapUniqAndIsDeleted_ById(table string, id int64) (res M.SX, uniq string, is_deleted bool)
fetch json data as map
func (*Tx) DoDelete2 ¶
func (tx *Tx) DoDelete2(actor int64, table string, id int64, lambda func(base *Base) string, ajax W.Ajax) bool
execute delete (is_deleted = true)
func (*Tx) DoForcedInsert ¶
do insert without checking
func (*Tx) DoRestore2 ¶
func (tx *Tx) DoRestore2(actor int64, table string, id int64, lambda func(base *Base) string, ajax W.Ajax) bool
execute delete (is_deleted = false)
func (*Tx) DoWipeUnwipe ¶
delete or restore
func (*Tx) QIntBoolMap ¶
query single column int64, return with true value
func (*Tx) QIntCountMap ¶
query 1 colums of integer
func (*Tx) QIntIntMap ¶
query 2 colums of integer-integer as map
func (*Tx) QIntStrMap ¶
query 2 colums of integer-string as map
func (*Tx) QJsonIntArr ¶
query one cell [1,2,3,...] and return array of int64
func (*Tx) QStrArrMap ¶
query 1+N colums of string-[]any as map
func (*Tx) QStrBoolMap ¶
query 1 colums of string as map SELECT unique_id
func (*Tx) QStrCountMap ¶
query 1 colums of string
func (*Tx) QStrIntMap ¶
query 2 colums of string-integer as map
func (*Tx) QStrStrMap ¶
query 2 colums of string-string as map