Documentation ¶
Index ¶
- Variables
- func ByID[E entities.Entity](ctx context.Context, name string, slice []*E, id int) (*E, error)
- type CommentRepository
- func (m *CommentRepository) Count(ctx context.Context, filters ...*entities.CommentFilter) (int, error)
- func (m *CommentRepository) Find(ctx context.Context, filters ...*entities.CommentFilter) ([]*entities.Comment, error)
- func (m *CommentRepository) FindWithPost(ctx context.Context, filters ...*entities.CommentFilter) ([]*entities.Comment, error)
- func (m *CommentRepository) Paginate(ctx context.Context, filters ...*entities.CommentFilter) (*entities.Paginate[entities.Comment], error)
- func (m *CommentRepository) PaginateWithPost(ctx context.Context, filters ...*entities.CommentFilter) (*entities.Paginate[entities.Comment], error)
- type FileRepository
- func (m *FileRepository) Count(ctx context.Context, filters ...*entities.FileFilter) (int, error)
- func (m *FileRepository) Find(ctx context.Context, filters ...*entities.FileFilter) ([]*entities.File, error)
- func (m *FileRepository) Paginate(ctx context.Context, filters ...*entities.FileFilter) (*entities.Paginate[entities.File], error)
- type Filter
- type PermissionRepository
- func (p *PermissionRepository) All(ctx context.Context) ([]*entities.Permission, error)
- func (m *PermissionRepository) Count(ctx context.Context, filters ...*entities.PermissionFilter) (int, error)
- func (m *PermissionRepository) Find(ctx context.Context, filters ...*entities.PermissionFilter) ([]*entities.Permission, error)
- func (m *PermissionRepository) Paginate(ctx context.Context, filters ...*entities.PermissionFilter) (*entities.Paginate[entities.Permission], error)
- type PostRepository
- func (m *PostRepository) Approve(ctx context.Context, id int) error
- func (m *PostRepository) Count(ctx context.Context, filters ...*entities.PostFilter) (int, error)
- func (m *PostRepository) Find(ctx context.Context, filters ...*entities.PostFilter) ([]*entities.Post, error)
- func (m *PostRepository) IncreaseViewCount(ctx context.Context, id int, views int64) error
- func (m *PostRepository) Paginate(ctx context.Context, filters ...*entities.PostFilter) (*entities.Paginate[entities.Post], error)
- func (m *PostRepository) PublishedPostByID(ctx context.Context, id int) (post *entities.Post, err error)
- type Repository
- func (m *Repository[E]) All(ctx context.Context) ([]*E, error)
- func (m *Repository[E]) ByID(ctx context.Context, id int) (*E, error)
- func (m *Repository[E]) Create(ctx context.Context, entity *E) (*E, error)
- func (m *Repository[E]) DeleteByID(ctx context.Context, id int) error
- func (m *Repository[E]) Find(ctx context.Context, filters ...*Filter) ([]*E, error)
- func (m *Repository[E]) Paginate(ctx context.Context, filters ...*entities.Filter) (*entities.Paginate[E], error)
- func (m *Repository[E]) Update(ctx context.Context, entity *E) (*E, error)
- type RoleRepository
- func (m *RoleRepository) All(ctx context.Context) ([]*entities.Role, error)
- func (m *RoleRepository) ByName(ctx context.Context, name string) (*entities.Role, error)
- func (m *RoleRepository) Count(ctx context.Context, filters ...*entities.RoleFilter) (int, error)
- func (m *RoleRepository) Find(ctx context.Context, filters ...*entities.RoleFilter) ([]*entities.Role, error)
- func (m *RoleRepository) Paginate(ctx context.Context, filters ...*entities.RoleFilter) (*entities.Paginate[entities.Role], error)
- func (m *RoleRepository) SetPermissions(ctx context.Context, id int, permissions []*entities.PermissionValue) error
- type TopicRepository
- func (m *TopicRepository) All(ctx context.Context) ([]*entities.Topic, error)
- func (m *TopicRepository) ByName(ctx context.Context, name string) (*entities.Topic, error)
- func (m *TopicRepository) Count(ctx context.Context, filters ...*entities.TopicFilter) (int, error)
- func (m *TopicRepository) Find(ctx context.Context, filters ...*entities.TopicFilter) ([]*entities.Topic, error)
- func (m *TopicRepository) Paginate(ctx context.Context, filters ...*entities.TopicFilter) (*entities.Paginate[entities.Topic], error)
- type UserRepository
- func (m *UserRepository) All(ctx context.Context) ([]*entities.User, error)
- func (m *UserRepository) ByProvider(ctx context.Context, name, id string) (*entities.User, error)
- func (m *UserRepository) ByUsername(ctx context.Context, name string) (*entities.User, error)
- func (m *UserRepository) ByUsernameOrEmail(ctx context.Context, username, email string) ([]*entities.User, error)
- func (m *UserRepository) Count(ctx context.Context, filters ...*entities.UserFilter) (int, error)
- func (m *UserRepository) CreateIfNotExistsByProvider(ctx context.Context, userData *entities.User) (*entities.User, error)
- func (m *UserRepository) Find(ctx context.Context, filters ...*entities.UserFilter) ([]*entities.User, error)
- func (m *UserRepository) Paginate(ctx context.Context, filters ...*entities.UserFilter) (*entities.Paginate[entities.User], error)
- func (m *UserRepository) Setting(ctx context.Context, id int, userData *entities.SettingMutation) (*entities.User, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorCreateIfNotExistsByProvider = false
View Source
var FakeRepoErrors = map[string]error{}
Functions ¶
Types ¶
type CommentRepository ¶
type CommentRepository struct { *Repository[entities.Comment] }
func (*CommentRepository) Count ¶
func (m *CommentRepository) Count(ctx context.Context, filters ...*entities.CommentFilter) (int, error)
func (*CommentRepository) Find ¶
func (m *CommentRepository) Find(ctx context.Context, filters ...*entities.CommentFilter) ([]*entities.Comment, error)
func (*CommentRepository) FindWithPost ¶
func (m *CommentRepository) FindWithPost(ctx context.Context, filters ...*entities.CommentFilter) ([]*entities.Comment, error)
func (*CommentRepository) Paginate ¶
func (m *CommentRepository) Paginate(ctx context.Context, filters ...*entities.CommentFilter) (*entities.Paginate[entities.Comment], error)
func (*CommentRepository) PaginateWithPost ¶
func (m *CommentRepository) PaginateWithPost(ctx context.Context, filters ...*entities.CommentFilter) (*entities.Paginate[entities.Comment], error)
type FileRepository ¶
type FileRepository struct { *Repository[entities.File] }
func (*FileRepository) Count ¶
func (m *FileRepository) Count(ctx context.Context, filters ...*entities.FileFilter) (int, error)
func (*FileRepository) Find ¶
func (m *FileRepository) Find(ctx context.Context, filters ...*entities.FileFilter) ([]*entities.File, error)
type Filter ¶
type Filter struct { Search string `form:"search" json:"search"` Page int `form:"page" json:"page"` Limit int `form:"limit" json:"limit"` Sorts []*entities.Sort `form:"orders" json:"orders"` IgnoreUrlParams []string `form:"ignore_url_params" json:"ignore_url_params"` ExcludeIDs []int `form:"exclude_ids" json:"exclude_ids"` }
type PermissionRepository ¶
type PermissionRepository struct { *Repository[entities.Permission] }
func (*PermissionRepository) All ¶
func (p *PermissionRepository) All(ctx context.Context) ([]*entities.Permission, error)
func (*PermissionRepository) Count ¶
func (m *PermissionRepository) Count(ctx context.Context, filters ...*entities.PermissionFilter) (int, error)
func (*PermissionRepository) Find ¶
func (m *PermissionRepository) Find(ctx context.Context, filters ...*entities.PermissionFilter) ([]*entities.Permission, error)
func (*PermissionRepository) Paginate ¶
func (m *PermissionRepository) Paginate(ctx context.Context, filters ...*entities.PermissionFilter) (*entities.Paginate[entities.Permission], error)
type PostRepository ¶
type PostRepository struct { *Repository[entities.Post] }
func (*PostRepository) Approve ¶
func (m *PostRepository) Approve(ctx context.Context, id int) error
func (*PostRepository) Count ¶
func (m *PostRepository) Count(ctx context.Context, filters ...*entities.PostFilter) (int, error)
func (*PostRepository) Find ¶
func (m *PostRepository) Find(ctx context.Context, filters ...*entities.PostFilter) ([]*entities.Post, error)
func (*PostRepository) IncreaseViewCount ¶
func (*PostRepository) Paginate ¶
func (m *PostRepository) Paginate(ctx context.Context, filters ...*entities.PostFilter) (*entities.Paginate[entities.Post], error)
func (*PostRepository) PublishedPostByID ¶
type Repository ¶
func (*Repository[E]) Create ¶
func (m *Repository[E]) Create(ctx context.Context, entity *E) (*E, error)
func (*Repository[E]) DeleteByID ¶
func (m *Repository[E]) DeleteByID(ctx context.Context, id int) error
func (*Repository[E]) Find ¶
func (m *Repository[E]) Find(ctx context.Context, filters ...*Filter) ([]*E, error)
type RoleRepository ¶
type RoleRepository struct { *Repository[entities.Role] }
func (*RoleRepository) Count ¶
func (m *RoleRepository) Count(ctx context.Context, filters ...*entities.RoleFilter) (int, error)
func (*RoleRepository) Find ¶
func (m *RoleRepository) Find(ctx context.Context, filters ...*entities.RoleFilter) ([]*entities.Role, error)
func (*RoleRepository) Paginate ¶
func (m *RoleRepository) Paginate(ctx context.Context, filters ...*entities.RoleFilter) (*entities.Paginate[entities.Role], error)
func (*RoleRepository) SetPermissions ¶
func (m *RoleRepository) SetPermissions(ctx context.Context, id int, permissions []*entities.PermissionValue) error
type TopicRepository ¶
type TopicRepository struct { *Repository[entities.Topic] }
func (*TopicRepository) Count ¶
func (m *TopicRepository) Count(ctx context.Context, filters ...*entities.TopicFilter) (int, error)
func (*TopicRepository) Find ¶
func (m *TopicRepository) Find(ctx context.Context, filters ...*entities.TopicFilter) ([]*entities.Topic, error)
type UserRepository ¶
type UserRepository struct { *Repository[entities.User] }
func (*UserRepository) ByProvider ¶
func (*UserRepository) ByUsername ¶
func (*UserRepository) ByUsernameOrEmail ¶
func (*UserRepository) Count ¶
func (m *UserRepository) Count(ctx context.Context, filters ...*entities.UserFilter) (int, error)
func (*UserRepository) CreateIfNotExistsByProvider ¶
func (*UserRepository) Find ¶
func (m *UserRepository) Find(ctx context.Context, filters ...*entities.UserFilter) ([]*entities.User, error)
Click to show internal directories.
Click to hide internal directories.