repositories

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArticlesCollectionName = "articles"
	PeopleCollectionName   = "people"
	VehicleCollectionName  = "vehicles"
	StarshipCOllectionName = "starships"
	UsersCollectionName    = "users"
)

Collection

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository struct {
	Factory *database.MongoFactory
}

Repository Entity

func NewRepo

func NewRepo(factory *database.MongoFactory) Repository

NewRepo Creates a new Article Repository object

func (*Repository) DeleteArticle

func (a *Repository) DeleteArticle(id string) *mongo.DeleteResult

DeleteArticle Deletes a record from the Article collection

func (*Repository) DeletePerson

func (a *Repository) DeletePerson(id string) *mongo.DeleteResult

DeletePerson Deletes a record from the Person collection

func (*Repository) GetAllArticles

func (a *Repository) GetAllArticles() []entities.Article

GetAllArticles Gets all the records from the Article collection

func (*Repository) GetAllPersons

func (a *Repository) GetAllPersons() []entities.Person

GetAllPersons Gets all the records from the Person collection

func (*Repository) GetArticleByID

func (a *Repository) GetArticleByID(id string) entities.Article

GetArticleByID Gets a record by ID

func (*Repository) GetPersonByID

func (a *Repository) GetPersonByID(id string) entities.Person

GetPersonByID Gets a record by ID

func (*Repository) GetUserByEmail

func (a *Repository) GetUserByEmail(email string) entities.User

GetUserByEmail Gets a record by ID

func (*Repository) UpdateArticle

func (a *Repository) UpdateArticle(article entities.Article) *mongo.UpdateResult

UpdateArticle Updates an article record

func (*Repository) UpdatePerson

func (a *Repository) UpdatePerson(Person entities.Person) *mongo.UpdateResult

UpdatePerson Updates an Person record

func (*Repository) UpsertArticle

func (a *Repository) UpsertArticle(article entities.Article) *mongo.UpdateResult

UpsertArticle Update/Insert and article in the database

func (*Repository) UpsertManyArticles

func (a *Repository) UpsertManyArticles(articles []entities.Article) *mongo.BulkWriteResult

UpsertManyArticles Bulk Inserts/Updates into the Articles collection

func (*Repository) UpsertManyPersons

func (a *Repository) UpsertManyPersons(Persons []entities.Person) *mongo.BulkWriteResult

UpsertManyPersons Bulk Inserts/Updates into the Persons collection

func (*Repository) UpsertPerson

func (a *Repository) UpsertPerson(Person entities.Person) *mongo.UpdateResult

UpsertPerson Update/Insert and Person in the database

Jump to

Keyboard shortcuts

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