repository

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

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

func (r *PostRepository) FindAllByTag(tagID uint, page, perPage int) ([]models.Post, int64, error)

FindAllByTag finds all posts with a specific tag (including non-visible)

func (*PostRepository) FindAllPaginated

func (r *PostRepository) FindAllPaginated(page, perPage int) ([]models.Post, int64, error)

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

func (*PostRepository) Update

func (r *PostRepository) Update(post *models.Post) error

Update updates an existing post

type Repositories

Repositories holds all repository implementations

func NewRepositories

func NewRepositories(db *gorm.DB) *Repositories

NewRepositories creates a new Repositories instance

Jump to

Keyboard shortcuts

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