mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-30 02:36:16 -06:00
wrap bun.DB in dbConn for dbconn specific error processing etc
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
This commit is contained in:
parent
fc561ef308
commit
0000c2c4a5
18 changed files with 171 additions and 141 deletions
|
|
@ -30,7 +30,7 @@ import (
|
|||
|
||||
type instanceDB struct {
|
||||
config *config.Config
|
||||
conn *bun.DB
|
||||
conn *dbConn
|
||||
log *logrus.Logger
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ func (i *instanceDB) CountInstanceUsers(ctx context.Context, domain string) (int
|
|||
|
||||
count, err := q.Count(ctx)
|
||||
|
||||
return count, processErrorResponse(err)
|
||||
return count, i.conn.ProcessError(err)
|
||||
}
|
||||
|
||||
func (i *instanceDB) CountInstanceStatuses(ctx context.Context, domain string) (int, db.Error) {
|
||||
|
|
@ -72,7 +72,7 @@ func (i *instanceDB) CountInstanceStatuses(ctx context.Context, domain string) (
|
|||
|
||||
count, err := q.Count(ctx)
|
||||
|
||||
return count, processErrorResponse(err)
|
||||
return count, i.conn.ProcessError(err)
|
||||
}
|
||||
|
||||
func (i *instanceDB) CountInstanceDomains(ctx context.Context, domain string) (int, db.Error) {
|
||||
|
|
@ -93,7 +93,7 @@ func (i *instanceDB) CountInstanceDomains(ctx context.Context, domain string) (i
|
|||
|
||||
count, err := q.Count(ctx)
|
||||
|
||||
return count, processErrorResponse(err)
|
||||
return count, i.conn.ProcessError(err)
|
||||
}
|
||||
|
||||
func (i *instanceDB) GetInstanceAccounts(ctx context.Context, domain string, maxID string, limit int) ([]*gtsmodel.Account, db.Error) {
|
||||
|
|
@ -114,7 +114,7 @@ func (i *instanceDB) GetInstanceAccounts(ctx context.Context, domain string, max
|
|||
q = q.Limit(limit)
|
||||
}
|
||||
|
||||
err := processErrorResponse(q.Scan(ctx))
|
||||
err := i.conn.ProcessError(q.Scan(ctx))
|
||||
|
||||
return accounts, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue