mongo

package
v0.1.0 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: 14 Imported by: 0

Documentation

Overview

Mongo implements the repository.Group interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoRepository

type MongoRepository struct {
	GroupsCollection  *mongo.Collection
	MembersCollection *mongo.Collection
}

func NewRepository

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

func (*MongoRepository) AddMembers

func (p *MongoRepository) AddMembers(ctx context.Context, userID []uuid.UUID, groupID uuid.UUID) error

func (*MongoRepository) BuildIndexes

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

func (*MongoRepository) Count

func (m *MongoRepository) Count(ctx context.Context) (int64, error)

Count returns a total count of groups in database.

func (*MongoRepository) CountMembers

func (r *MongoRepository) CountMembers(ctx context.Context, groupID uuid.UUID) (uint64, error)

func (*MongoRepository) Create

func (m *MongoRepository) Create(ctx context.Context, group *group.Group) (*group.Group, error)

Create inserts a new group (document) in the database.

func (*MongoRepository) Delete

func (m *MongoRepository) Delete(ctx context.Context, groupID uuid.UUID) error

Delete removes the group (document) from the database.

func (*MongoRepository) DeleteAll

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

func (*MongoRepository) Get

func (m *MongoRepository) Get(ctx context.Context, groupID uuid.UUID) (*group.Group, error)

Get returns a specific group (document) with "id".

func (*MongoRepository) GetByName

func (m *MongoRepository) GetByName(ctx context.Context, name string) (*group.Group, error)

func (*MongoRepository) List

func (m *MongoRepository) List(ctx context.Context, pagination *model.Pagination, search string) (iterator.Iterator[*group.Group], uint64, error)

List implements group_repository.GroupRepository

func (*MongoRepository) ListGroupsForUser

func (r *MongoRepository) ListGroupsForUser(ctx context.Context, userID uuid.UUID, pagination *model.Pagination) (iterator.Iterator[uuid.UUID], uint64, error)

func (*MongoRepository) ListMembers

func (r *MongoRepository) ListMembers(ctx context.Context, groupID uuid.UUID, pagination *model.Pagination) (iterator.Iterator[uuid.UUID], uint64, error)

func (*MongoRepository) RemoveMember

func (p *MongoRepository) RemoveMember(ctx context.Context, userID, groupID uuid.UUID) error

func (*MongoRepository) RemoveMemberFromAll

func (p *MongoRepository) RemoveMemberFromAll(ctx context.Context, userID uuid.UUID) error

func (*MongoRepository) Update

func (m *MongoRepository) Update(ctx context.Context, group *group.Group) (*group.Group, error)

Update updates the name of a specific group.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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