mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-14 20:03:01 -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
|
|
@ -18,54 +18,58 @@
|
|||
|
||||
package db
|
||||
|
||||
import "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
)
|
||||
|
||||
// Relationship contains functions for getting or modifying the relationship between two accounts.
|
||||
type Relationship interface {
|
||||
// IsBlocked checks whether account 1 has a block in place against block2.
|
||||
// If eitherDirection is true, then the function returns true if account1 blocks account2, OR if account2 blocks account1.
|
||||
IsBlocked(account1 string, account2 string, eitherDirection bool) (bool, Error)
|
||||
IsBlocked(ctx context.Context, account1 string, account2 string, eitherDirection bool) (bool, Error)
|
||||
|
||||
// GetBlock returns the block from account1 targeting account2, if it exists, or an error if it doesn't.
|
||||
//
|
||||
// Because this is slower than Blocked, only use it if you need the actual Block struct for some reason,
|
||||
// not if you're just checking for the existence of a block.
|
||||
GetBlock(account1 string, account2 string) (*gtsmodel.Block, Error)
|
||||
GetBlock(ctx context.Context, account1 string, account2 string) (*gtsmodel.Block, Error)
|
||||
|
||||
// GetRelationship retrieves the relationship of the targetAccount to the requestingAccount.
|
||||
GetRelationship(requestingAccount string, targetAccount string) (*gtsmodel.Relationship, Error)
|
||||
GetRelationship(ctx context.Context, requestingAccount string, targetAccount string) (*gtsmodel.Relationship, Error)
|
||||
|
||||
// IsFollowing returns true if sourceAccount follows target account, or an error if something goes wrong while finding out.
|
||||
IsFollowing(sourceAccount *gtsmodel.Account, targetAccount *gtsmodel.Account) (bool, Error)
|
||||
IsFollowing(ctx context.Context, sourceAccount *gtsmodel.Account, targetAccount *gtsmodel.Account) (bool, Error)
|
||||
|
||||
// IsFollowRequested returns true if sourceAccount has requested to follow target account, or an error if something goes wrong while finding out.
|
||||
IsFollowRequested(sourceAccount *gtsmodel.Account, targetAccount *gtsmodel.Account) (bool, Error)
|
||||
IsFollowRequested(ctx context.Context, sourceAccount *gtsmodel.Account, targetAccount *gtsmodel.Account) (bool, Error)
|
||||
|
||||
// IsMutualFollowing returns true if account1 and account2 both follow each other, or an error if something goes wrong while finding out.
|
||||
IsMutualFollowing(account1 *gtsmodel.Account, account2 *gtsmodel.Account) (bool, Error)
|
||||
IsMutualFollowing(ctx context.Context, account1 *gtsmodel.Account, account2 *gtsmodel.Account) (bool, Error)
|
||||
|
||||
// AcceptFollowRequest moves a follow request in the database from the follow_requests table to the follows table.
|
||||
// In other words, it should create the follow, and delete the existing follow request.
|
||||
//
|
||||
// It will return the newly created follow for further processing.
|
||||
AcceptFollowRequest(originAccountID string, targetAccountID string) (*gtsmodel.Follow, Error)
|
||||
AcceptFollowRequest(ctx context.Context, originAccountID string, targetAccountID string) (*gtsmodel.Follow, Error)
|
||||
|
||||
// GetAccountFollowRequests returns all follow requests targeting the given account.
|
||||
GetAccountFollowRequests(accountID string) ([]*gtsmodel.FollowRequest, Error)
|
||||
GetAccountFollowRequests(ctx context.Context, accountID string) ([]*gtsmodel.FollowRequest, Error)
|
||||
|
||||
// GetAccountFollows returns a slice of follows owned by the given accountID.
|
||||
GetAccountFollows(accountID string) ([]*gtsmodel.Follow, Error)
|
||||
GetAccountFollows(ctx context.Context, accountID string) ([]*gtsmodel.Follow, Error)
|
||||
|
||||
// CountAccountFollows returns the amount of accounts that the given accountID is following.
|
||||
//
|
||||
// If localOnly is set to true, then only follows from *this instance* will be returned.
|
||||
CountAccountFollows(accountID string, localOnly bool) (int, Error)
|
||||
CountAccountFollows(ctx context.Context, accountID string, localOnly bool) (int, Error)
|
||||
|
||||
// GetAccountFollowedBy fetches follows that target given accountID.
|
||||
//
|
||||
// If localOnly is set to true, then only follows from *this instance* will be returned.
|
||||
GetAccountFollowedBy(accountID string, localOnly bool) ([]*gtsmodel.Follow, Error)
|
||||
GetAccountFollowedBy(ctx context.Context, accountID string, localOnly bool) ([]*gtsmodel.Follow, Error)
|
||||
|
||||
// CountAccountFollowedBy returns the amounts that the given ID is followed by.
|
||||
CountAccountFollowedBy(accountID string, localOnly bool) (int, Error)
|
||||
CountAccountFollowedBy(ctx context.Context, accountID string, localOnly bool) (int, Error)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue