Documentation ¶
Index ¶
- type MongoRepository
- func (r *MongoRepository) BuildIndexes(ctx context.Context) error
- func (r *MongoRepository) Count(ctx context.Context) (uint64, error)
- func (r *MongoRepository) Create(ctx context.Context, p *user.User) (*user.User, error)
- func (r *MongoRepository) CreateOauth2Link(ctx context.Context, userID uuid.UUID, p *oauth2.ProviderLink) error
- func (r *MongoRepository) Delete(ctx context.Context, userID uuid.UUID) (*user.User, error)
- func (r *MongoRepository) DeleteAll(ctx context.Context) error
- func (r *MongoRepository) DeleteMany(ctx context.Context, userBatch []*model.UserIdentifier) (uint64, error)
- func (r *MongoRepository) DeleteOauth2Links(ctx context.Context, userID uuid.UUID) error
- func (r *MongoRepository) Get(ctx context.Context, userID uuid.UUID) (*user.User, error)
- func (r *MongoRepository) GetByIdentifier(ctx context.Context, id *model.UserIdentifier) (*user.User, error)
- func (m *MongoRepository) GetOauth2Link(ctx context.Context, issuer string, subject string) (uuid.UUID, *oauth2.ProviderLink, error)
- func (r *MongoRepository) GetPassword(ctx context.Context, userID uuid.UUID) (*model.HashingInstance, error)
- func (r *MongoRepository) List(ctx context.Context, set *settings.Settings, pagination *model.Pagination, ...) (iterator.Iterator[*model.UserEntry], uint64, error)
- func (r *MongoRepository) Update(ctx context.Context, p *user.User) (*user.User, error)
- func (r *MongoRepository) UpdatePassword(ctx context.Context, userID uuid.UUID, password *model.HashingInstance) error
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) CreateOauth2Link ¶
func (r *MongoRepository) CreateOauth2Link(ctx context.Context, userID uuid.UUID, p *oauth2.ProviderLink) error
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 (*MongoRepository) DeleteOauth2Links ¶
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 (*MongoRepository) GetOauth2Link ¶
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 ¶
func (r *MongoRepository) List(ctx context.Context, set *settings.Settings, pagination *model.Pagination, search string) (iterator.Iterator[*model.UserEntry], uint64, error)
List fetches all users matching the filter.
func (*MongoRepository) Update ¶
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.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.