mongodb

package
v0.0.0-...-349e90a Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseWrapper

type DatabaseWrapper struct {
	*mongo.Database
}

func Connect

func Connect() DatabaseWrapper

func (*DatabaseWrapper) CreateGroup

func (db *DatabaseWrapper) CreateGroup(data models.NewGroup) (*models.Group, error)

func (*DatabaseWrapper) CreateHabit

func (db *DatabaseWrapper) CreateHabit(data models.HabitCreate) (*models.Habit, error)

func (*DatabaseWrapper) CreateIndex

func (db *DatabaseWrapper) CreateIndex(
	collectionName string,
	field string,
	unique bool,
) error

func (*DatabaseWrapper) CreateSuccess

func (db *DatabaseWrapper) CreateSuccess(input models.SuccessCreate) (*models.Success, error)

func (*DatabaseWrapper) CreateUser

func (db *DatabaseWrapper) CreateUser(credentials models.Credentials) (*models.User, error)

func (*DatabaseWrapper) DeleteGroupByID

func (db *DatabaseWrapper) DeleteGroupByID(id primitive.ObjectID) (*models.Group, error)

func (*DatabaseWrapper) DeleteHabitByID

func (db *DatabaseWrapper) DeleteHabitByID(id primitive.ObjectID) (*models.Habit, error)

func (*DatabaseWrapper) DeleteSuccessByID

func (db *DatabaseWrapper) DeleteSuccessByID(id primitive.ObjectID) (*models.Success, error)

func (*DatabaseWrapper) Disconnect

func (db *DatabaseWrapper) Disconnect()

func (*DatabaseWrapper) GetGroupByID

func (db *DatabaseWrapper) GetGroupByID(id primitive.ObjectID) (*models.Group, error)

func (*DatabaseWrapper) GetGroupsByUserID

func (db *DatabaseWrapper) GetGroupsByUserID(userID primitive.ObjectID) ([]*models.Group, error)

func (*DatabaseWrapper) GetHabitByID

func (db *DatabaseWrapper) GetHabitByID(id primitive.ObjectID) (*models.Habit, error)

func (*DatabaseWrapper) GetHabitsByGroupID

func (db *DatabaseWrapper) GetHabitsByGroupID(groupID primitive.ObjectID) ([]*models.Habit, error)

func (*DatabaseWrapper) GetHabitsByUserID

func (db *DatabaseWrapper) GetHabitsByUserID(userID primitive.ObjectID) ([]*models.Habit, error)

func (*DatabaseWrapper) GetHabitsWithFilter

func (db *DatabaseWrapper) GetHabitsWithFilter(
	options models.HabitFilterOptions,
) ([]*models.Habit, error)

func (*DatabaseWrapper) GetSuccessByID

func (db *DatabaseWrapper) GetSuccessByID(id primitive.ObjectID) (*models.Success, error)

func (*DatabaseWrapper) GetSuccessesByHabitID

func (db *DatabaseWrapper) GetSuccessesByHabitID(
	habitID primitive.ObjectID,
) ([]*models.Success, error)

func (*DatabaseWrapper) GetUserByEmail

func (db *DatabaseWrapper) GetUserByEmail(email string) (*models.User, error)

func (*DatabaseWrapper) GetUserByID

func (db *DatabaseWrapper) GetUserByID(id primitive.ObjectID) (*models.User, error)

func (*DatabaseWrapper) UpdateGroup

func (db *DatabaseWrapper) UpdateGroup(data models.GroupUpdate) (*models.Group, error)

func (*DatabaseWrapper) UpdateHabit

func (db *DatabaseWrapper) UpdateHabit(data models.HabitUpdate) (*models.Habit, error)

Jump to

Keyboard shortcuts

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