2017-11-06 04:02:35 +00:00
|
|
|
/* WIP: A version of the builder which accumulates errors, we'll see if we can't unify the implementations at some point */
|
|
|
|
package qgen
|
|
|
|
|
2017-11-06 07:23:32 +00:00
|
|
|
import (
|
2022-02-21 03:32:53 +00:00
|
|
|
"database/sql"
|
|
|
|
"log"
|
|
|
|
"strings"
|
2017-11-06 07:23:32 +00:00
|
|
|
)
|
2017-11-06 04:02:35 +00:00
|
|
|
|
2018-06-06 06:13:55 +00:00
|
|
|
var LogPrepares = true
|
|
|
|
|
2018-08-04 11:46:36 +00:00
|
|
|
// So we don't have to do the qgen.Builder.Accumulator() boilerplate all the time
|
|
|
|
func NewAcc() *Accumulator {
|
2022-02-21 03:32:53 +00:00
|
|
|
return Builder.Accumulator()
|
2018-08-04 11:46:36 +00:00
|
|
|
}
|
|
|
|
|
2017-11-12 03:29:05 +00:00
|
|
|
type Accumulator struct {
|
2022-02-21 03:32:53 +00:00
|
|
|
conn *sql.DB
|
|
|
|
adapter Adapter
|
|
|
|
firstErr error
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SetConn(conn *sql.DB) {
|
2022-02-21 03:32:53 +00:00
|
|
|
acc.conn = conn
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SetAdapter(name string) error {
|
2022-02-21 03:32:53 +00:00
|
|
|
adap, err := GetAdapter(name)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
acc.adapter = adap
|
|
|
|
return nil
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) GetAdapter() Adapter {
|
2022-02-21 03:32:53 +00:00
|
|
|
return acc.adapter
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) FirstError() error {
|
2022-02-21 03:32:53 +00:00
|
|
|
return acc.firstErr
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) RecordError(err error) {
|
2022-02-21 03:32:53 +00:00
|
|
|
if err == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if acc.firstErr == nil {
|
|
|
|
acc.firstErr = err
|
|
|
|
}
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) prepare(res string, err error) *sql.Stmt {
|
2022-02-21 03:32:53 +00:00
|
|
|
// TODO: Can we make this less noisy on debug mode?
|
|
|
|
if LogPrepares {
|
|
|
|
log.Print("res: ", res)
|
|
|
|
}
|
|
|
|
if err != nil {
|
|
|
|
acc.RecordError(err)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
stmt, err := acc.conn.Prepare(res)
|
|
|
|
acc.RecordError(err)
|
|
|
|
return stmt
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) RawPrepare(res string) *sql.Stmt {
|
2022-02-21 03:32:53 +00:00
|
|
|
return acc.prepare(res, nil)
|
2019-02-10 05:52:26 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) query(q string, args ...interface{}) (rows *sql.Rows, err error) {
|
2022-02-21 03:32:53 +00:00
|
|
|
err = acc.FirstError()
|
|
|
|
if err != nil {
|
|
|
|
return rows, err
|
|
|
|
}
|
|
|
|
return acc.conn.Query(q, args...)
|
2018-07-29 10:54:12 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) exec(q string, args ...interface{}) (res sql.Result, err error) {
|
2022-02-21 03:32:53 +00:00
|
|
|
err = acc.FirstError()
|
|
|
|
if err != nil {
|
|
|
|
return res, err
|
|
|
|
}
|
|
|
|
return acc.conn.Exec(q, args...)
|
2018-07-29 10:54:12 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) Tx(handler func(*TransactionBuilder) error) {
|
2022-02-21 03:32:53 +00:00
|
|
|
tx, err := acc.conn.Begin()
|
|
|
|
if err != nil {
|
|
|
|
acc.RecordError(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
err = handler(&TransactionBuilder{tx, acc.adapter, nil})
|
|
|
|
if err != nil {
|
|
|
|
tx.Rollback()
|
|
|
|
acc.RecordError(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
acc.RecordError(tx.Commit())
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleSelect(table, columns, where, orderby, limit string) *sql.Stmt {
|
2022-02-21 03:32:53 +00:00
|
|
|
return acc.prepare(acc.adapter.SimpleSelect("", table, columns, where, orderby, limit))
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleCount(table, where, limit string) *sql.Stmt {
|
2022-02-21 03:32:53 +00:00
|
|
|
return acc.prepare(acc.adapter.SimpleCount("", table, where, limit))
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleLeftJoin(table1, table2, columns, joiners, where, orderby, limit string) *sql.Stmt {
|
2022-02-21 03:32:53 +00:00
|
|
|
return acc.prepare(acc.adapter.SimpleLeftJoin("", table1, table2, columns, joiners, where, orderby, limit))
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleInnerJoin(table1, table2, columns, joiners, where, orderby, limit string) *sql.Stmt {
|
2022-02-21 03:32:53 +00:00
|
|
|
return acc.prepare(acc.adapter.SimpleInnerJoin("", table1, table2, columns, joiners, where, orderby, limit))
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) CreateTable(table, charset, collation string, columns []DBTableColumn, keys []DBTableKey) *sql.Stmt {
|
2022-02-21 03:32:53 +00:00
|
|
|
return acc.prepare(acc.adapter.CreateTable("", table, charset, collation, columns, keys))
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleInsert(table, columns, fields string) *sql.Stmt {
|
2022-02-21 03:32:53 +00:00
|
|
|
return acc.prepare(acc.adapter.SimpleInsert("", table, columns, fields))
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleBulkInsert(table, cols string, fieldSet []string) *sql.Stmt {
|
2022-02-21 03:32:53 +00:00
|
|
|
return acc.prepare(acc.adapter.SimpleBulkInsert("", table, cols, fieldSet))
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleInsertSelect(ins DBInsert, sel DBSelect) *sql.Stmt {
|
2022-02-21 03:32:53 +00:00
|
|
|
return acc.prepare(acc.adapter.SimpleInsertSelect("", ins, sel))
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleInsertLeftJoin(ins DBInsert, sel DBJoin) *sql.Stmt {
|
2022-02-21 03:32:53 +00:00
|
|
|
return acc.prepare(acc.adapter.SimpleInsertLeftJoin("", ins, sel))
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleInsertInnerJoin(ins DBInsert, sel DBJoin) *sql.Stmt {
|
2022-02-21 03:32:53 +00:00
|
|
|
return acc.prepare(acc.adapter.SimpleInsertInnerJoin("", ins, sel))
|
2018-12-27 05:42:41 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleUpdate(table, set, where string) *sql.Stmt {
|
2022-02-21 03:32:53 +00:00
|
|
|
return acc.prepare(acc.adapter.SimpleUpdate(qUpdate(table, set, where)))
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleUpdateSelect(table, set, table2, cols, where, orderby, limit string) *sql.Stmt {
|
2022-02-21 03:32:53 +00:00
|
|
|
pre := qUpdate(table, set, "").WhereQ(acc.GetAdapter().Builder().Select().Table(table2).Columns(cols).Where(where).Orderby(orderby).Limit(limit))
|
|
|
|
return acc.prepare(acc.adapter.SimpleUpdateSelect(pre))
|
2020-02-24 11:15:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (acc *Accumulator) SimpleDelete(table, where string) *sql.Stmt {
|
2022-02-21 03:32:53 +00:00
|
|
|
return acc.prepare(acc.adapter.SimpleDelete("", table, where))
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// I don't know why you need this, but here it is x.x
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) Purge(table string) *sql.Stmt {
|
2022-02-21 03:32:53 +00:00
|
|
|
return acc.prepare(acc.adapter.Purge("", table))
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) prepareTx(tx *sql.Tx, res string, err error) (stmt *sql.Stmt) {
|
2022-02-21 03:32:53 +00:00
|
|
|
if err != nil {
|
|
|
|
acc.RecordError(err)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
stmt, err = tx.Prepare(res)
|
|
|
|
acc.RecordError(err)
|
|
|
|
return stmt
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2017-11-06 16:24:45 +00:00
|
|
|
// These ones support transactions
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleSelectTx(tx *sql.Tx, table, columns, where, orderby, limit string) (stmt *sql.Stmt) {
|
2022-02-21 03:32:53 +00:00
|
|
|
res, err := acc.adapter.SimpleSelect("", table, columns, where, orderby, limit)
|
|
|
|
return acc.prepareTx(tx, res, err)
|
2017-11-06 16:24:45 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleCountTx(tx *sql.Tx, table, where, limit string) (stmt *sql.Stmt) {
|
2022-02-21 03:32:53 +00:00
|
|
|
res, err := acc.adapter.SimpleCount("", table, where, limit)
|
|
|
|
return acc.prepareTx(tx, res, err)
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleLeftJoinTx(tx *sql.Tx, table1, table2, columns, joiners, where, orderby, limit string) (stmt *sql.Stmt) {
|
2022-02-21 03:32:53 +00:00
|
|
|
res, err := acc.adapter.SimpleLeftJoin("", table1, table2, columns, joiners, where, orderby, limit)
|
|
|
|
return acc.prepareTx(tx, res, err)
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleInnerJoinTx(tx *sql.Tx, table1, table2, columns, joiners, where, orderby, limit string) (stmt *sql.Stmt) {
|
2022-02-21 03:32:53 +00:00
|
|
|
res, err := acc.adapter.SimpleInnerJoin("", table1, table2, columns, joiners, where, orderby, limit)
|
|
|
|
return acc.prepareTx(tx, res, err)
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) CreateTableTx(tx *sql.Tx, table, charset, collation string, columns []DBTableColumn, keys []DBTableKey) (stmt *sql.Stmt) {
|
2022-02-21 03:32:53 +00:00
|
|
|
res, err := acc.adapter.CreateTable("", table, charset, collation, columns, keys)
|
|
|
|
return acc.prepareTx(tx, res, err)
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleInsertTx(tx *sql.Tx, table, columns, fields string) (stmt *sql.Stmt) {
|
2022-02-21 03:32:53 +00:00
|
|
|
res, err := acc.adapter.SimpleInsert("", table, columns, fields)
|
|
|
|
return acc.prepareTx(tx, res, err)
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleInsertSelectTx(tx *sql.Tx, ins DBInsert, sel DBSelect) (stmt *sql.Stmt) {
|
2022-02-21 03:32:53 +00:00
|
|
|
res, err := acc.adapter.SimpleInsertSelect("", ins, sel)
|
|
|
|
return acc.prepareTx(tx, res, err)
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleInsertLeftJoinTx(tx *sql.Tx, ins DBInsert, sel DBJoin) (stmt *sql.Stmt) {
|
2022-02-21 03:32:53 +00:00
|
|
|
res, err := acc.adapter.SimpleInsertLeftJoin("", ins, sel)
|
|
|
|
return acc.prepareTx(tx, res, err)
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleInsertInnerJoinTx(tx *sql.Tx, ins DBInsert, sel DBJoin) (stmt *sql.Stmt) {
|
2022-02-21 03:32:53 +00:00
|
|
|
res, err := acc.adapter.SimpleInsertInnerJoin("", ins, sel)
|
|
|
|
return acc.prepareTx(tx, res, err)
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleUpdateTx(tx *sql.Tx, table, set, where string) (stmt *sql.Stmt) {
|
2022-02-21 03:32:53 +00:00
|
|
|
res, err := acc.adapter.SimpleUpdate(qUpdate(table, set, where))
|
|
|
|
return acc.prepareTx(tx, res, err)
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleDeleteTx(tx *sql.Tx, table, where string) (stmt *sql.Stmt) {
|
2022-02-21 03:32:53 +00:00
|
|
|
res, err := acc.adapter.SimpleDelete("", table, where)
|
|
|
|
return acc.prepareTx(tx, res, err)
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// I don't know why you need this, but here it is x.x
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) PurgeTx(tx *sql.Tx, table string) (stmt *sql.Stmt) {
|
2022-02-21 03:32:53 +00:00
|
|
|
res, err := acc.adapter.Purge("", table)
|
|
|
|
return acc.prepareTx(tx, res, err)
|
2020-02-24 11:15:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (acc *Accumulator) Delete(table string) *accDeleteBuilder {
|
2022-02-21 03:32:53 +00:00
|
|
|
return &accDeleteBuilder{table, "", nil, acc}
|
2017-11-06 04:02:35 +00:00
|
|
|
}
|
2017-11-11 08:46:30 +00:00
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) Update(table string) *accUpdateBuilder {
|
2022-02-21 03:32:53 +00:00
|
|
|
return &accUpdateBuilder{qUpdate(table, "", ""), acc}
|
2017-11-11 08:46:30 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) Select(table string) *AccSelectBuilder {
|
2022-02-21 03:32:53 +00:00
|
|
|
return &AccSelectBuilder{table, "", "", "", "", nil, nil, "", acc}
|
2017-11-12 03:29:05 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) Exists(tbl, col string) *AccSelectBuilder {
|
2022-02-21 03:32:53 +00:00
|
|
|
return acc.Select(tbl).Columns(col).Where(col + "=?")
|
2017-11-12 03:29:05 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) Insert(table string) *accInsertBuilder {
|
2022-02-21 03:32:53 +00:00
|
|
|
return &accInsertBuilder{table, "", "", acc}
|
2019-10-29 01:58:04 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) BulkInsert(table string) *accBulkInsertBuilder {
|
2022-02-21 03:32:53 +00:00
|
|
|
return &accBulkInsertBuilder{table, "", nil, acc}
|
2017-11-12 03:29:05 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) Count(table string) *accCountBuilder {
|
2022-02-21 03:32:53 +00:00
|
|
|
return &accCountBuilder{table, "", "", nil, nil, "", acc}
|
2017-11-12 03:29:05 +00:00
|
|
|
}
|
2019-10-29 01:58:04 +00:00
|
|
|
|
|
|
|
type SimpleModel struct {
|
2022-02-21 03:32:53 +00:00
|
|
|
delete *sql.Stmt
|
|
|
|
create *sql.Stmt
|
|
|
|
update *sql.Stmt
|
2019-10-29 01:58:04 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) SimpleModel(tbl, colstr, primary string) SimpleModel {
|
2022-02-21 03:32:53 +00:00
|
|
|
var qlist, uplist string
|
|
|
|
for _, col := range strings.Split(colstr, ",") {
|
|
|
|
qlist += "?,"
|
|
|
|
uplist += col + "=?,"
|
|
|
|
}
|
|
|
|
if len(qlist) > 0 {
|
|
|
|
qlist = qlist[0 : len(qlist)-1]
|
|
|
|
uplist = uplist[0 : len(uplist)-1]
|
|
|
|
}
|
|
|
|
|
|
|
|
where := primary + "=?"
|
|
|
|
return SimpleModel{
|
|
|
|
delete: acc.Delete(tbl).Where(where).Prepare(),
|
|
|
|
create: acc.Insert(tbl).Columns(colstr).Fields(qlist).Prepare(),
|
|
|
|
update: acc.Update(tbl).Set(uplist).Where(where).Prepare(),
|
|
|
|
}
|
2019-10-29 01:58:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m SimpleModel) Delete(keyVal interface{}) error {
|
2022-02-21 03:32:53 +00:00
|
|
|
_, err := m.delete.Exec(keyVal)
|
|
|
|
return err
|
2019-10-29 01:58:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m SimpleModel) Update(args ...interface{}) error {
|
2022-02-21 03:32:53 +00:00
|
|
|
_, err := m.update.Exec(args...)
|
|
|
|
return err
|
2019-10-29 01:58:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m SimpleModel) Create(args ...interface{}) error {
|
2022-02-21 03:32:53 +00:00
|
|
|
_, err := m.create.Exec(args...)
|
|
|
|
return err
|
2019-10-29 01:58:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m SimpleModel) CreateID(args ...interface{}) (int, error) {
|
2022-02-21 03:32:53 +00:00
|
|
|
res, err := m.create.Exec(args...)
|
|
|
|
if err != nil {
|
|
|
|
return 0, err
|
|
|
|
}
|
|
|
|
lastID, err := res.LastInsertId()
|
|
|
|
return int(lastID), err
|
2019-10-29 01:58:04 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:15:17 +00:00
|
|
|
func (acc *Accumulator) Model(table string) *accModelBuilder {
|
2022-02-21 03:32:53 +00:00
|
|
|
return &accModelBuilder{table, "", acc}
|
2019-10-29 01:58:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type accModelBuilder struct {
|
2022-02-21 03:32:53 +00:00
|
|
|
table string
|
|
|
|
primary string
|
2019-10-29 01:58:04 +00:00
|
|
|
|
2022-02-21 03:32:53 +00:00
|
|
|
build *Accumulator
|
2019-10-29 01:58:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (b *accModelBuilder) Primary(col string) *accModelBuilder {
|
2022-02-21 03:32:53 +00:00
|
|
|
b.primary = col
|
|
|
|
return b
|
2019-12-31 21:57:54 +00:00
|
|
|
}
|