mongo

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoRepository

type MongoRepository struct {
	UsersCol         *mongo.Collection
	Oauth2Col        *mongo.Collection
	ValidatePassword bool
}

func NewRepository

func NewRepository(c *mongo.Client) (*MongoRepository, error)

func (*MongoRepository) BuildIndexes

func (r *MongoRepository) BuildIndexes(ctx context.Context) error

BuildIndexes builds the MongoDB indexes for the user object.

func (*MongoRepository) Count

func (r *MongoRepository) Count(ctx context.Context) (uint64, error)

Count returns the amount of user in a project.

func (*MongoRepository) Create

func (r *MongoRepository) Create(ctx context.Context, p *user.User) (*user.User, error)

Create inserts a user in the database.

func (r *MongoRepository) CreateOauth2Link(ctx context.Context, userID uuid.UUID, p *oauth2.ProviderLink) error

func (*MongoRepository) Delete

func (r *MongoRepository) Delete(ctx context.Context, userID uuid.UUID) (*user.User, error)

Delete deletes a specific user with id, email or username.

func (*MongoRepository) DeleteAll

func (r *MongoRepository) DeleteAll(ctx context.Context) error

DeleteAll deletes all users in the collection.

func (*MongoRepository) DeleteMany

func (r *MongoRepository) DeleteMany(ctx context.Context, userBatch []*model.UserIdentifier) (uint64, error)

DeleteBatch deletes a batch of user by id, email or username.

func (r *MongoRepository) DeleteOauth2Links(ctx context.Context, userID uuid.UUID) error

func (*MongoRepository) Get

func (r *MongoRepository) Get(ctx context.Context, userID uuid.UUID) (*user.User, error)

Get fetches a user either by id, username, or email.

func (*MongoRepository) GetByIdentifier

func (r *MongoRepository) GetByIdentifier(ctx context.Context, id *model.UserIdentifier) (*user.User, error)

Get fetches a user either by id, username, or email.

func (m *MongoRepository) GetOauth2Link(ctx context.Context, issuer string, subject string) (uuid.UUID, *oauth2.ProviderLink, error)

func (*MongoRepository) GetPassword

func (r *MongoRepository) GetPassword(ctx context.Context, userID uuid.UUID) (*model.HashingInstance, error)

Get fetches a user either by id, username, or email.

func (*MongoRepository) List

List fetches all users matching the filter.

func (*MongoRepository) Update

func (r *MongoRepository) Update(ctx context.Context, p *user.User) (*user.User, error)

Update updates the profile info and/or extra data of a specific user.

func (*MongoRepository) UpdatePassword

func (r *MongoRepository) UpdatePassword(ctx context.Context, userID uuid.UUID, password *model.HashingInstance) error

UpdatePassword hashes and updates the password of a specific user.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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