user

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplySingleActionDB

func ApplySingleActionDB(ctx context.Context, tx pgx.Tx, userDBID int64, applierDBID pgtype.Int8, removerDBID pgtype.Int8, action *ms.ModAction) error

Types

type DBStore

type DBStore struct {
	// contains filtered or unexported fields
}

DBStore is a postgres-backed store for users.

func NewDBStore

func NewDBStore(p *pgxpool.Pool) (*DBStore, error)

func (*DBStore) AddBlock

func (s *DBStore) AddBlock(ctx context.Context, targetUser, blocker uint) error

func (*DBStore) AddFollower

func (s *DBStore) AddFollower(ctx context.Context, targetUser, follower uint) error

AddFollower creates a follower -> target follow.

func (*DBStore) ApplyActions

func (s *DBStore) ApplyActions(ctx context.Context, actions []*ms.ModAction) error

func (*DBStore) CachedCount

func (s *DBStore) CachedCount(ctx context.Context) int

func (*DBStore) Count

func (s *DBStore) Count(ctx context.Context) (int64, error)

func (*DBStore) Disconnect

func (s *DBStore) Disconnect()

func (*DBStore) Get

func (s *DBStore) Get(ctx context.Context, username string) (*entity.User, error)

Get gets a user by username.

func (*DBStore) GetAPIKey

func (s *DBStore) GetAPIKey(ctx context.Context, uuid string) (string, error)

func (*DBStore) GetActionHistory

func (s *DBStore) GetActionHistory(ctx context.Context, userUUID string) ([]*ms.ModAction, error)

func (*DBStore) GetActions

func (s *DBStore) GetActions(ctx context.Context, userUUID string) (map[string]*ms.ModAction, error)

func (*DBStore) GetBlockedBy

func (s *DBStore) GetBlockedBy(ctx context.Context, uid uint) ([]*entity.User, error)

GetBlockedBy gets all the users that are blocking the passed-in user DB ID.

func (*DBStore) GetBlocks

func (s *DBStore) GetBlocks(ctx context.Context, uid uint) ([]*entity.User, error)

GetBlocks gets all the users that the passed-in user DB ID is blocking.

func (*DBStore) GetBot

func (s *DBStore) GetBot(ctx context.Context, botType macondopb.BotRequest_BotCode) (*entity.User, error)

func (*DBStore) GetBriefProfiles

func (s *DBStore) GetBriefProfiles(ctx context.Context, uuids []string) (map[string]*pb.BriefProfile, error)

func (*DBStore) GetByAPIKey

func (s *DBStore) GetByAPIKey(ctx context.Context, apikey string) (*entity.User, error)

GetByAPIKey gets a user by api key. It does not try to fetch the profile. We only call this for API functions where we care about access levels, etc.

func (*DBStore) GetByEmail

func (s *DBStore) GetByEmail(ctx context.Context, email string) (*entity.User, error)

GetByEmail gets the user by email. It does not try to get the profile. We don't get the profile here because GetByEmail is only used for things like password resets and there is no need.

func (*DBStore) GetByUUID

func (s *DBStore) GetByUUID(ctx context.Context, uuid string) (*entity.User, error)

GetByUUID gets user by UUID

func (*DBStore) GetFollowedBy

func (s *DBStore) GetFollowedBy(ctx context.Context, uid uint) ([]*entity.User, error)

GetFollowedBy gets all the users that are following the passed-in user DB ID.

func (*DBStore) GetFollows

func (s *DBStore) GetFollows(ctx context.Context, uid uint) ([]*entity.User, error)

GetFollows gets all the users that the passed-in user DB ID is following.

func (*DBStore) GetFullBlocks

func (s *DBStore) GetFullBlocks(ctx context.Context, uid uint) ([]*entity.User, error)

GetFullBlocks gets users uid is blocking AND users blocking uid

func (*DBStore) GetModList

func (s *DBStore) GetModList(ctx context.Context) (*pb.GetModListResponse, error)

func (*DBStore) ListAllIDs

func (s *DBStore) ListAllIDs(ctx context.Context) ([]string, error)

List all user IDs.

func (*DBStore) New

func (s *DBStore) New(ctx context.Context, u *entity.User) error

New creates a new user in the DB.

func (*DBStore) RemoveActions

func (s *DBStore) RemoveActions(ctx context.Context, actions []*ms.ModAction) error

func (*DBStore) RemoveBlock

func (s *DBStore) RemoveBlock(ctx context.Context, targetUser, blocker uint) error

func (*DBStore) RemoveFollower

func (s *DBStore) RemoveFollower(ctx context.Context, targetUser, follower uint) error

RemoveFollower removes a follower -> target follow.

func (*DBStore) ResetAPIKey

func (s *DBStore) ResetAPIKey(ctx context.Context, uuid string) (string, error)

func (*DBStore) ResetPersonalInfo

func (s *DBStore) ResetPersonalInfo(ctx context.Context, uuid string) error

func (*DBStore) ResetProfile

func (s *DBStore) ResetProfile(ctx context.Context, uid string) error

func (*DBStore) ResetRatings

func (s *DBStore) ResetRatings(ctx context.Context, uuid string) error

func (*DBStore) ResetStats

func (s *DBStore) ResetStats(ctx context.Context, uuid string) error

func (*DBStore) ResetStatsAndRatings

func (s *DBStore) ResetStatsAndRatings(ctx context.Context, uuid string) error

func (*DBStore) SetAvatarUrl

func (s *DBStore) SetAvatarUrl(ctx context.Context, uuid string, avatarUrl string) error

SetAvatarUrl sets the avatar_url (profile field) for the user.

func (*DBStore) SetNotoriety

func (s *DBStore) SetNotoriety(ctx context.Context, uuid string, notoriety int) error

func (*DBStore) SetPassword

func (s *DBStore) SetPassword(ctx context.Context, uuid string, hashpass string) error

SetPassword sets the password for the user. The password is already hashed.

func (*DBStore) SetPermissions

func (s *DBStore) SetPermissions(ctx context.Context, req *cpb.PermissionsRequest) error

func (*DBStore) SetPersonalInfo

func (s *DBStore) SetPersonalInfo(ctx context.Context, uuid string, email string, firstName string, lastName string, birthDate string, countryCode string, about string) error

func (*DBStore) SetRatings

func (s *DBStore) SetRatings(ctx context.Context, p0uuid string, p1uuid string, variant entity.VariantKey,
	p0Rating *entity.SingleRating, p1Rating *entity.SingleRating) error

SetRatings set the specific ratings for the given variant in a transaction.

func (*DBStore) SetStats

func (s *DBStore) SetStats(ctx context.Context, p0uuid string, p1uuid string, variant entity.VariantKey,
	p0Stats *entity.Stats, p1Stats *entity.Stats) error

func (*DBStore) Username

func (s *DBStore) Username(ctx context.Context, uuid string) (string, error)

func (*DBStore) UsersByPrefix

func (s *DBStore) UsersByPrefix(ctx context.Context, prefix string) ([]*pb.BasicUser, error)

type DBUniqueValues

type DBUniqueValues struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL