dbrepo

package
v0.0.0-...-04c0119 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorAlreadyUpToDate = "up to date"
View Source
var ErrorDocumentNotFound = "document not found"
View Source
var ErrorNameEmailPasswordEmpty = "either name or email or password cannot be empty"
View Source
var ErrorTitleAndTextEmpty = "title and text cannot be empty"

Functions

func NewMongoDBRepo

func NewMongoDBRepo(app *config.AppConfig, conn *mongo.Database) database.DatabaseRepo

NewMongoDBRepo is the function for returning a mongoDBRepo.

func NewTestingRepo

func NewTestingRepo(app *config.AppConfig) database.DatabaseRepo

NewTestingRepo is the function for returning a testDBRepo.

Types

type Post

type Post struct {
	ID        primitive.ObjectID `bson:"_id,omitempty"`
	Title     string             `bson:"title,omitempty"`
	Text      string             `bson:"text,omitempty"`
	Creator   string             `bson:"creator,omitempty"`
	CreatedAt time.Time          `bson:"created_at,omitempty"`
	UpdatedAt time.Time          `bson:"updated_at,omitempty"`
}

Post is the Post type used for communication with the mongo driver.

type User

type User struct {
	ID        primitive.ObjectID `bson:"_id,omitempty"`
	Name      string             `bson:"name,omitempty"`
	Email     string             `bson:"email,omitempty" validate:"omitempty,email"`
	Password  string             `bson:"password,omitempty"`
	Roles     []string           `bson:"roles,omitempty"`
	CreatedAt time.Time          `bson:"created_at,omitempty"`
}

User is the User type used for communication with the mongo driver.

Jump to

Keyboard shortcuts

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