Documentation ¶
Index ¶
- func NewMediaRepository(db *gorm.DB) models.MediaRepository
- func NewMenuItemRepository(db *gorm.DB) models.MenuItemRepository
- func NewPageRepository(db *gorm.DB) models.PageRepository
- func NewPostRepository(db *gorm.DB) models.PostRepository
- func NewSettingsRepository(db *gorm.DB) models.SettingsRepository
- func NewTagRepository(db *gorm.DB) models.TagRepository
- func NewUserRepository(db *gorm.DB) models.UserRepository
- type PostRepository
- func (r *PostRepository) AssociateTags(post *models.Post, tags []string) error
- func (r *PostRepository) CountByAuthor(user *models.User) (int64, error)
- func (r *PostRepository) CountByTag(tagID uint) (int64, error)
- func (r *PostRepository) Create(post *models.Post) error
- func (r *PostRepository) Delete(post *models.Post) error
- func (r *PostRepository) FindAll() ([]*models.Post, error)
- func (r *PostRepository) FindAllByTag(tagID uint, page, perPage int) ([]models.Post, int64, error)
- func (r *PostRepository) FindAllPaginated(page, perPage int) ([]models.Post, int64, error)
- func (r *PostRepository) FindByID(id uint) (*models.Post, error)
- func (r *PostRepository) FindBySlug(slug string) (*models.Post, error)
- func (r *PostRepository) FindByTag(tag string) ([]*models.Post, error)
- func (r *PostRepository) FindRecent(limit int) ([]*models.Post, error)
- func (r *PostRepository) FindVisibleByTag(tagID uint, page, perPage int, timezone string) ([]models.Post, int64, error)
- func (r *PostRepository) FindVisiblePaginated(page, perPage int, timezone string) ([]models.Post, int64, error)
- func (r *PostRepository) Update(post *models.Post) error
- type Repositories
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMediaRepository ¶
func NewMediaRepository(db *gorm.DB) models.MediaRepository
NewMediaRepository creates a new media repository
func NewMenuItemRepository ¶
func NewMenuItemRepository(db *gorm.DB) models.MenuItemRepository
NewMenuItemRepository creates a new menu item repository
func NewPageRepository ¶
func NewPageRepository(db *gorm.DB) models.PageRepository
NewPageRepository creates a new page repository
func NewPostRepository ¶
func NewPostRepository(db *gorm.DB) models.PostRepository
NewPostRepository creates a new post repository
func NewSettingsRepository ¶
func NewSettingsRepository(db *gorm.DB) models.SettingsRepository
NewSettingsRepository creates a new settings repository
func NewTagRepository ¶
func NewTagRepository(db *gorm.DB) models.TagRepository
NewTagRepository creates a new tag repository
func NewUserRepository ¶
func NewUserRepository(db *gorm.DB) models.UserRepository
NewUserRepository creates a new user repository
Types ¶
type PostRepository ¶
type PostRepository struct {
// contains filtered or unexported fields
}
PostRepository handles database operations for posts
func (*PostRepository) AssociateTags ¶
func (r *PostRepository) AssociateTags(post *models.Post, tags []string) error
AssociateTags associates tags with a post
func (*PostRepository) CountByAuthor ¶
func (r *PostRepository) CountByAuthor(user *models.User) (int64, error)
func (*PostRepository) CountByTag ¶
func (r *PostRepository) CountByTag(tagID uint) (int64, error)
func (*PostRepository) Create ¶
func (r *PostRepository) Create(post *models.Post) error
Create creates a new post
func (*PostRepository) Delete ¶
func (r *PostRepository) Delete(post *models.Post) error
Delete deletes a post
func (*PostRepository) FindAll ¶
func (r *PostRepository) FindAll() ([]*models.Post, error)
FindAll finds all posts
func (*PostRepository) FindAllByTag ¶
FindAllByTag finds all posts with a specific tag (including non-visible)
func (*PostRepository) FindAllPaginated ¶
FindAllPaginated finds all posts with pagination
func (*PostRepository) FindByID ¶
func (r *PostRepository) FindByID(id uint) (*models.Post, error)
FindByID finds a post by ID
func (*PostRepository) FindBySlug ¶
func (r *PostRepository) FindBySlug(slug string) (*models.Post, error)
FindBySlug finds a post by slug
func (*PostRepository) FindByTag ¶
func (r *PostRepository) FindByTag(tag string) ([]*models.Post, error)
FindByTag finds all posts with a specific tag slug
func (*PostRepository) FindRecent ¶
func (r *PostRepository) FindRecent(limit int) ([]*models.Post, error)
FindRecent finds the most recent posts
func (*PostRepository) FindVisibleByTag ¶
func (r *PostRepository) FindVisibleByTag(tagID uint, page, perPage int, timezone string) ([]models.Post, int64, error)
FindVisibleByTag finds all visible posts with a specific tag
func (*PostRepository) FindVisiblePaginated ¶
func (r *PostRepository) FindVisiblePaginated(page, perPage int, timezone string) ([]models.Post, int64, error)
FindVisiblePaginated finds all visible posts with pagination
type Repositories ¶
type Repositories struct { Posts models.PostRepository Tags models.TagRepository Users models.UserRepository Pages models.PageRepository MenuItems models.MenuItemRepository Settings models.SettingsRepository Media models.MediaRepository }
Repositories holds all repository implementations
func NewRepositories ¶
func NewRepositories(db *gorm.DB) *Repositories
NewRepositories creates a new Repositories instance