repositories

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommentRepository

type CommentRepository interface {
	Create(comment *models.Comment) error

	Get(cid uint) (*models.Comment, error)

	GetByPostIdAndIsApproved(pid uint, isApproved bool, count uint) ([]*models.Comment, error)

	GetByPostId(pid uint, count uint) ([]*models.Comment, error)

	ListByUserId(uid, page, pageSize uint) ([]*models.Comment, error)

	List(page, pageSize uint) ([]*models.Comment, error)

	DeleteByIdAndUserId(cid uint, uid uint) error

	DeleteById(cid uint) error

	Update(comment *models.Comment) error
}

func NewCommentRepository

func NewCommentRepository(db *gorm.DB) CommentRepository

type LikeRepository

type LikeRepository interface {
	Create(comment *models.Like) error

	GetByPostId(pid uint) ([]*models.Like, error)

	GetByUserIdAndPostId(uid uint, pid uint) (*models.Like, error)

	GetByIPAndPostId(ip string, pid uint) (*models.Like, error)

	DeleteById(lid uint) error

	Get(lid uint) (*models.Like, error)

	VisitorLikeCount(pid uint) (uint, error)
}

func NewLikeRepository

func NewLikeRepository(db *gorm.DB) LikeRepository

type PostRepository

type PostRepository interface {
	Create(post *models.Post) error

	Get(pid uint) (*models.Post, error)

	ListByUserIdAndVisibility(uid uint, visibility models.Visibility, page, pageSize uint) ([]*models.Post, error)

	ListByUserId(uid uint, page, pageSize uint) ([]*models.Post, error)

	List(page, pageSize uint) ([]*models.Post, error)

	DeleteByIdAndUserId(pid uint, uid uint) error

	Update(post *models.Post) error

	BatchUpdateApprovedStatusByUid(uid uint, newStatus bool) error

	BatchUpdatePriorityByUid(uid uint, newPriority uint) error
}

func NewPostRepository

func NewPostRepository(db *gorm.DB) PostRepository

type UserProfileRepository

type UserProfileRepository interface {
	Create(userProfile *models.UserProfile) error

	FindByUserId(userId uint) (*models.UserProfile, error)

	Update(userProfile *models.UserProfile) error
}

func NewUserProfileRepository

func NewUserProfileRepository(db *gorm.DB) UserProfileRepository

type UserRepository

type UserRepository interface {
	Create(user *models.User) error

	FindById(id uint) (*models.User, error)

	FindByEmail(email string) (*models.User, error)

	FindByEmailAndPassword(email string, password string) (*models.User, error)

	Update(user *models.User) error

	UpdatePassword(userid uint, password string) error

	ForceDelete(userid uint) error

	ListAll() ([]*models.SimpleUser, error)

	Count() (uint, error)

	FindAdmin() (*models.User, error)
}

func NewUserRepository

func NewUserRepository(db *gorm.DB) UserRepository

Jump to

Keyboard shortcuts

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