mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-05 17:08:08 -06:00
Pg to bun (#148)
* start moving to bun * changing more stuff * more * and yet more * tests passing * seems stable now * more big changes * small fix * little fixes
This commit is contained in:
parent
071eca20ce
commit
2dc9fc1626
713 changed files with 98694 additions and 22704 deletions
|
|
@ -32,7 +32,7 @@ import (
|
|||
// Owns returns true if the IRI belongs to this instance, and if
|
||||
// the database has an entry for the IRI.
|
||||
// The library makes this call only after acquiring a lock first.
|
||||
func (f *federatingDB) Owns(c context.Context, id *url.URL) (bool, error) {
|
||||
func (f *federatingDB) Owns(ctx context.Context, id *url.URL) (bool, error) {
|
||||
l := f.log.WithFields(
|
||||
logrus.Fields{
|
||||
"func": "Owns",
|
||||
|
|
@ -54,7 +54,7 @@ func (f *federatingDB) Owns(c context.Context, id *url.URL) (bool, error) {
|
|||
if err != nil {
|
||||
return false, fmt.Errorf("error parsing statuses path for url %s: %s", id.String(), err)
|
||||
}
|
||||
status, err := f.db.GetStatusByURI(uid)
|
||||
status, err := f.db.GetStatusByURI(ctx, uid)
|
||||
if err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
// there are no entries for this status
|
||||
|
|
@ -71,7 +71,7 @@ func (f *federatingDB) Owns(c context.Context, id *url.URL) (bool, error) {
|
|||
if err != nil {
|
||||
return false, fmt.Errorf("error parsing statuses path for url %s: %s", id.String(), err)
|
||||
}
|
||||
if _, err := f.db.GetLocalAccountByUsername(username); err != nil {
|
||||
if _, err := f.db.GetLocalAccountByUsername(ctx, username); err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
// there are no entries for this username
|
||||
return false, nil
|
||||
|
|
@ -88,7 +88,7 @@ func (f *federatingDB) Owns(c context.Context, id *url.URL) (bool, error) {
|
|||
if err != nil {
|
||||
return false, fmt.Errorf("error parsing statuses path for url %s: %s", id.String(), err)
|
||||
}
|
||||
if _, err := f.db.GetLocalAccountByUsername(username); err != nil {
|
||||
if _, err := f.db.GetLocalAccountByUsername(ctx, username); err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
// there are no entries for this username
|
||||
return false, nil
|
||||
|
|
@ -105,7 +105,7 @@ func (f *federatingDB) Owns(c context.Context, id *url.URL) (bool, error) {
|
|||
if err != nil {
|
||||
return false, fmt.Errorf("error parsing statuses path for url %s: %s", id.String(), err)
|
||||
}
|
||||
if _, err := f.db.GetLocalAccountByUsername(username); err != nil {
|
||||
if _, err := f.db.GetLocalAccountByUsername(ctx, username); err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
// there are no entries for this username
|
||||
return false, nil
|
||||
|
|
@ -122,7 +122,7 @@ func (f *federatingDB) Owns(c context.Context, id *url.URL) (bool, error) {
|
|||
if err != nil {
|
||||
return false, fmt.Errorf("error parsing like path for url %s: %s", id.String(), err)
|
||||
}
|
||||
if _, err := f.db.GetLocalAccountByUsername(username); err != nil {
|
||||
if _, err := f.db.GetLocalAccountByUsername(ctx, username); err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
// there are no entries for this username
|
||||
return false, nil
|
||||
|
|
@ -130,7 +130,7 @@ func (f *federatingDB) Owns(c context.Context, id *url.URL) (bool, error) {
|
|||
// an actual error happened
|
||||
return false, fmt.Errorf("database error fetching account with username %s: %s", username, err)
|
||||
}
|
||||
if err := f.db.GetByID(likeID, >smodel.StatusFave{}); err != nil {
|
||||
if err := f.db.GetByID(ctx, likeID, >smodel.StatusFave{}); err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
// there are no entries
|
||||
return false, nil
|
||||
|
|
@ -147,7 +147,7 @@ func (f *federatingDB) Owns(c context.Context, id *url.URL) (bool, error) {
|
|||
if err != nil {
|
||||
return false, fmt.Errorf("error parsing block path for url %s: %s", id.String(), err)
|
||||
}
|
||||
if _, err := f.db.GetLocalAccountByUsername(username); err != nil {
|
||||
if _, err := f.db.GetLocalAccountByUsername(ctx, username); err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
// there are no entries for this username
|
||||
return false, nil
|
||||
|
|
@ -155,7 +155,7 @@ func (f *federatingDB) Owns(c context.Context, id *url.URL) (bool, error) {
|
|||
// an actual error happened
|
||||
return false, fmt.Errorf("database error fetching account with username %s: %s", username, err)
|
||||
}
|
||||
if err := f.db.GetByID(blockID, >smodel.Block{}); err != nil {
|
||||
if err := f.db.GetByID(ctx, blockID, >smodel.Block{}); err != nil {
|
||||
if err == db.ErrNoEntries {
|
||||
// there are no entries
|
||||
return false, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue