refactor: sqlx - delete TypedError

This commit is contained in:
Anton
2024-04-28 08:49:25 +05:00
parent c6bdaf08a2
commit 1b55ad8652
6 changed files with 7 additions and 12 deletions

View File

@@ -453,7 +453,7 @@ func (tx *Tx) set(key string, field string, value any) error {
}
_, err := tx.tx.Exec(sqlSet, args...)
if err != nil {
return sqlx.TypedError(err)
return err
}
return nil
}

View File

@@ -239,7 +239,7 @@ func set(tx sqlx.Tx, key string, value any, at time.Time) error {
}
_, err := tx.Exec(sqlSet, args...)
if err != nil {
return sqlx.TypedError(err)
return err
}
return nil
}
@@ -260,7 +260,7 @@ func update(tx sqlx.Tx, key string, value any) error {
}
_, err := tx.Exec(sqlUpdate, args...)
if err != nil {
return sqlx.TypedError(err)
return err
}
return nil
}

View File

@@ -181,7 +181,7 @@ func (c InterCmd) store(tx sqlx.Tx) (int, error) {
res, err := tx.Exec(query, args...)
if err != nil {
return 0, sqlx.TypedError(err)
return 0, err
}
// Return the number of elements in the resulting set.

View File

@@ -241,7 +241,7 @@ func (tx *Tx) Incr(key string, elem any, delta float64) (float64, error) {
}
_, err := tx.tx.Exec(sqlIncr1, args...)
if err != nil {
return 0, sqlx.TypedError(err)
return 0, err
}
var score float64
@@ -373,7 +373,7 @@ func (tx *Tx) add(key string, elem any, score float64) error {
_, err := tx.tx.Exec(sqlAdd, args...)
if err != nil {
return sqlx.TypedError(err)
return err
}
return nil
}

View File

@@ -176,7 +176,7 @@ func (c UnionCmd) store(tx sqlx.Tx) (int, error) {
res, err := tx.Exec(query, args...)
if err != nil {
return 0, sqlx.TypedError(err)
return 0, err
}
// Return the number of elements in the resulting set.

View File

@@ -67,8 +67,3 @@ func Select[T any](db Tx, query string, args []any,
return vals, err
}
// Returns typed errors for some specific cases.
func TypedError(err error) error {
return err
}