func (t PgsqlTx) Rollback() error { err := t.tx.Rollback() if err != nil { err = usecases.NewDbError(err, "") LogSQLError(err) } return err }
func (handler *PgsqlHandler) Begin() (interfaces.Tx, error) { tx, err := handler.Conn.Begin() if err != nil { err = usecases.NewDbError(err, "") LogSQLError(err) } return &PgsqlTx{tx}, err }
func (r PgsqlResult) RowsAffected() (int64, error) { rt, err := r.res.RowsAffected() if err != nil { err = usecases.NewDbError(err, "") LogSQLError(err) } return rt, err }
func (t PgsqlTx) Commit() error { err := t.tx.Commit() if err != nil { err = usecases.NewDbError(err, "") LogSQLError(err) } return err }
func (r PgsqlRow) Scan(dest ...interface{}) error { err := r.row.Scan(dest...) if err != nil { err = usecases.NewDbError(err, "") LogSQLError(err) } return err }
func (r PgsqlRows) Err() error { err := r.rows.Err() if err != nil { err = usecases.NewDbError(err, "") LogSQLError(err) } return err }
func (t PgsqlTx) Query(query string, args ...interface{}) (interfaces.Rows, error) { queryStr, passArgs := processQueryAndArguments(query, args) rows, err := t.tx.Query(queryStr, passArgs...) if err != nil { err = usecases.NewDbError(err, query) LogSQLError(err) } return &PgsqlRows{rows}, err }
func (t PgsqlTx) Exec(query string, args ...interface{}) (interfaces.Result, error) { queryStr, passArgs := processQueryAndArguments(query, args) ret, err := t.tx.Exec(queryStr, passArgs...) if err != nil { err = usecases.NewDbError(err, query) LogSQLError(err) } return &PgsqlResult{ret}, err }
func (handler *PgsqlHandler) Query(query string, args ...interface{}) (interfaces.Rows, error) { var start, end int64 queryStr, passArgs := processQueryAndArguments(query, args) if Profile { start = time.Now().UnixNano() } rows, err := handler.Conn.Query(queryStr, passArgs...) if Profile { end = time.Now().UnixNano() ProfiledQueries = append(ProfiledQueries, interfaces.DbProfile{queryStr, passArgs, time.Duration(end-start) * time.Nanosecond, time.Duration(end-start)*time.Nanosecond > 500*time.Millisecond}) } if err != nil { err = usecases.NewDbError(err, query) LogSQLError(err) } return &PgsqlRows{rows}, err }