Example #1
0
/*
Load record from a where condition map
*/
func LoadByCols(db *sql.DB, val PtrRecord, cols WhereMap) *Result {
	var sqlstring = sqlutils.BuildSelectClause(val)
	whereSql, args := sqlutils.BuildWhereClauseWithAndOp(cols, GetHolderTypeByDriver(driverType))
	sqlstring += whereSql + sqlutils.BuildLimitClause(1)
	return LoadFromQueryRow(db, val, sqlstring, args...)
}
Example #2
0
func LoadWith(db *sql.DB, val PtrRecord, postQuery string, args ...interface{}) *Result {
	var sqlstring = sqlutils.BuildSelectClause(val) + " " + postQuery + sqlutils.BuildLimitClause(1)
	return LoadFromQueryRow(db, val, sqlstring, args...)
}