Documentation ¶
Index ¶
- Variables
- func PrintApp(app *BoApp)
- type BoApp
- type DaoAppSql
- func (dao *DaoAppSql) Create(bo *BoApp) (bool, error)
- func (dao *DaoAppSql) Delete(bo *BoApp) (bool, error)
- func (dao *DaoAppSql) EnableTxMode(txMode bool)
- func (dao *DaoAppSql) GdaoCreateFilter(_ string, bo godal.IGenericBo) godal.FilterOpt
- func (dao *DaoAppSql) Get(id string) (*BoApp, error)
- func (dao *DaoAppSql) GetAll() ([]*BoApp, error)
- func (dao *DaoAppSql) GetN(startOffset, numRows int) ([]*BoApp, error)
- func (dao *DaoAppSql) Update(bo *BoApp) (bool, error)
- func (dao *DaoAppSql) Upsert(bo *BoApp) (bool, error)
- type IDaoApp
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // SEP defines separator string used for displaying purpose SEP = "================================================================================" // TIMEZONE defines the timezone used for all examples TIMEZONE = "Asia/Ho_Chi_Minh" )
View Source
var ColsSql = []string{"id", "val_desc", "val_bool", "val_int", "val_float", "val_string",
"val_time", "val_timez", "val_date", "val_datez", "val_datetime", "val_datetimez", "val_timestamp", "val_timestampz",
"val_list", "val_map"}
ColsSql holds name of database table columns.
Functions ¶
Types ¶
type BoApp ¶
type BoApp struct { Id string `json:"id"` Description string `json:"val_desc"` ValBool bool `json:"val_bool"` ValInt int `json:"val_int"` ValFloat float64 `json:"val_float"` ValString string `json:"val_string"` ValTime time.Time `json:"val_time"` ValTimeZ time.Time `json:"val_timez"` ValDate time.Time `json:"val_date"` ValDateZ time.Time `json:"val_datez"` ValDatetime time.Time `json:"val_datetime"` ValDatetimeZ time.Time `json:"val_datetimez"` ValTimestamp time.Time `json:"val_timestamp"` ValTimestampZ time.Time `json:"val_timestampz"` ValList []interface{} `json:"val_list"` ValMap map[string]interface{} `json:"val_map"` }
BoApp defines business object app
func (*BoApp) FromGenericBo ¶
func (app *BoApp) FromGenericBo(gbo godal.IGenericBo) *BoApp
FromGenericBo imports BoApp's data from a godal.IGenericBo instance.
func (*BoApp) ToGenericBo ¶
func (app *BoApp) ToGenericBo() godal.IGenericBo
ToGenericBo transforms BoApp to godal.IGenericBo
type DaoAppSql ¶
type DaoAppSql struct { // *sql.GenericDaoSql sql.IGenericDaoSql TableName string }
DaoAppSql is SQL-based DAO implementation.
func (*DaoAppSql) EnableTxMode ¶
EnableTxMode implements IDaoApp.EnableTxMode
func (*DaoAppSql) GdaoCreateFilter ¶
GdaoCreateFilter implements godal.IGenericDao.GdaoCreateFilter.
type IDaoApp ¶
type IDaoApp interface { // EnableTxMode enables/disables transaction mode EnableTxMode(txMode bool) // Delete removes an app from database store. Delete(bo *BoApp) (bool, error) // Create persists a new app to database store. If the app already existed, this function returns (false, nil) Create(bo *BoApp) (bool, error) // Get finds an app by id & fetches it from database store. Get(id string) (*BoApp, error) // GetAll retrieves all available apps from database store and returns them as a list. GetAll() ([]*BoApp, error) // GetN retries apps from database store with paging. GetN(startOffset, numRows int) ([]*BoApp, error) // Update modifies an existing app in the database store. If the application does not exist in database, this function returns (false, nil). Update(bo *BoApp) (bool, error) // Upsert performs "update-or-create" on the specified app: the app is updated/modified if it already existed, otherwise it is created. Upsert(bo *BoApp) (bool, error) }
IDaoApp defines DAO APIs for apps
Click to show internal directories.
Click to hide internal directories.