Documentation
¶
Index ¶
- Constants
- type Repository
- func (a *Repository) DeleteArticle(id string) *mongo.DeleteResult
- func (a *Repository) DeletePerson(id string) *mongo.DeleteResult
- func (a *Repository) GetAllArticles() []entities.Article
- func (a *Repository) GetAllPersons() []entities.Person
- func (a *Repository) GetArticleByID(id string) entities.Article
- func (a *Repository) GetPersonByID(id string) entities.Person
- func (a *Repository) GetUserByEmail(email string) entities.User
- func (a *Repository) UpdateArticle(article entities.Article) *mongo.UpdateResult
- func (a *Repository) UpdatePerson(Person entities.Person) *mongo.UpdateResult
- func (a *Repository) UpsertArticle(article entities.Article) *mongo.UpdateResult
- func (a *Repository) UpsertManyArticles(articles []entities.Article) *mongo.BulkWriteResult
- func (a *Repository) UpsertManyPersons(Persons []entities.Person) *mongo.BulkWriteResult
- func (a *Repository) UpsertPerson(Person entities.Person) *mongo.UpdateResult
Constants ¶
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