Documentation ¶
Index ¶
- Constants
- type Repository
- func (a *Repository) DeleteArticle(id string) *mongo.DeleteResult
- func (a *Repository) GetAllArticles() []entities.Article
- func (a *Repository) GetArticleByID(id string) entities.Article
- func (a *Repository) GetUserByEmail(email string) entities.User
- func (a *Repository) UpdateArticle(article entities.Article) *mongo.UpdateResult
- func (a *Repository) UpsertArticle(article entities.Article) *mongo.UpdateResult
- func (a *Repository) UpsertManyArticles(articles []entities.Article) *mongo.BulkWriteResult
Constants ¶
View Source
const ( ArticlesCollectionName = "articles" 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) GetAllArticles ¶
func (a *Repository) GetAllArticles() []entities.Article
GetAllArticles Gets all the records from the Article collection
func (*Repository) GetArticleByID ¶
func (a *Repository) GetArticleByID(id string) entities.Article
GetArticleByID 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) 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
Click to show internal directories.
Click to hide internal directories.