Documentation ¶
Index ¶
- Constants
- type CRepository
- func (r *CRepository) DeleteAll() error
- func (r *CRepository) DeleteById(id string) error
- func (r *CRepository) GetAllURLsByCategory(category string, count int) (url []*models.Category, err error)
- func (r *CRepository) GetById(id string) (url *models.Category, err error)
- func (r *CRepository) GetCategoryByURL(url string) (category *models.Category, err error)
- func (r *CRepository) Save(url *models.Category) error
- func (r *CRepository) Update(category *models.Category) error
- type CategoriesRepository
Constants ¶
View Source
const CategoriesCollection = "categories"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CRepository ¶
type CRepository struct {
// contains filtered or unexported fields
}
CRepository provides a mongo collection for database job.
func (*CRepository) DeleteAll ¶
func (r *CRepository) DeleteAll() error
DeleteAll drops categories collection.
func (*CRepository) DeleteById ¶
func (r *CRepository) DeleteById(id string) error
Delete deletes the url based on id.
func (*CRepository) GetAllURLsByCategory ¶
func (r *CRepository) GetAllURLsByCategory(category string, count int) (url []*models.Category, err error)
GetAllURLsByCategory returns all urls based on category.
func (*CRepository) GetById ¶
func (r *CRepository) GetById(id string) (url *models.Category, err error)
GetById returns the url based on id.
func (*CRepository) GetCategoryByURL ¶
func (r *CRepository) GetCategoryByURL(url string) (category *models.Category, err error)
GetCategoryByURL returns the category based on url.
type CategoriesRepository ¶
type CategoriesRepository interface { Save(url *models.Category) error GetById(id string) (url *models.Category, err error) GetCategoryByURL(url string) (category *models.Category, err error) GetAllURLsByCategory(category string, count int) (url []*models.Category, err error) Update(category *models.Category) error DeleteById(id string) error }
CategoriesRepository is the interface of the categorization backend.
func NewCategoriesRepository ¶
func NewCategoriesRepository(conn db.Connection) CategoriesRepository
NewCategoriesRepository creates a new CategoriesRepository instance.
Click to show internal directories.
Click to hide internal directories.