func (f *Follow) txDo(db *gomodel.DB, do func(gomodel.Tx, *Follow) error) (err error) { tx, err := db.Begin() if err != nil { return } defer tx.DeferDone(&err) err = do(tx, f) return }
func (u *User) txDo(db *gomodel.DB, do func(gomodel.Tx, *User) error) (err error) { tx, err := db.Begin() if err != nil { return } defer tx.DeferDone(&err) err = do(tx, u) return }
func (m *message) txDo(db *gomodel.DB, do func(*gomodel.Tx, *message) error) error { tx, err := db.Begin() if err != nil { return err } defer tx.Close() err = do(tx, m) tx.Success(err == nil) return err }
func (f *Follow) txDo(db *gomodel.DB, do func(*gomodel.Tx, *Follow) error) error { tx, err := db.Begin() if err != nil { return err } defer tx.Close() err = do(tx, f) tx.Success(err == nil) return err }
func NewDBBackend(db *gomodel.DB, timeFormat string) (b gotmsq.Backend, err error) { d := &DB{timeFormat: timeFormat} b = d defer func(d *DB, err *error) { if *err == nil { return } if d.stmtClearTimeout != nil { d.stmtClearTimeout.Close() } if d.stmtInsert != nil { d.stmtInsert.Close() } if d.stmtQueryMessage != nil { d.stmtQueryMessage.Close() } if d.stmtDeleteById != nil { d.stmtDeleteById.Close() } }(d, &err) d.stmtClearTimeout, err = db.StmtById(deleteTimeoutMessagesSQL) if err != nil { return } d.stmtQueryMessage, err = db.StmtById(queryMessageSQL) if err != nil { return } d.stmtDeleteById, err = db.StmtById(deleteMessageByIdSQL) if err != nil { return } d.stmtInsert, err = db.StmtById(insertMessageSQL) if err != nil { return } return }