repositories

package
v0.0.0-...-3c93229 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostRepository

type PostRepository interface {
	Create(p *models.Post) error
	GetAll() ([]*models.Post, error)
	FindByID(id int) (*models.Post, error)
	FindByIDAdmin(id int) (*models.Post, error)
	FindBySlug(slug string) (*models.Post, error)
	FindBySlugAdmin(slug string) (*models.Post, error)
	Exists(slug string) bool
	Delete(id int) error
	Update(p *models.Post) error
	Paginate(maxID int, perPage int, tags []string) ([]*models.Post, int, error)
	PaginateAdmin(maxID int, perPage int, tags []string) ([]*models.Post, int, error)
	GetTotalPostCount() (int, error)
	GetPublicPostCount() (int, error)
	ResetSeq() error
	GetLastID() (int, error)
	GetLastIDAdmin() (int, error)
	SearchQuery(string, []string) ([]*models.Post, error)
}

PostRepository interface

func NewPostRepository

func NewPostRepository(db *database.Postgres) PostRepository

NewPostRepository - creates a post repository instance

type UserRepository

type UserRepository interface {
	Create(u *models.User) error
	CreateFirstAdmin(u *models.User) (bool, error)
	GetAll() ([]*models.User, error)
	GetAllDetailed() ([]*models.AuthUser, error)
	FindByID(id string) (*models.User, error)
	FindByIDDetailed(id string) (*models.User, error)
	FindByEmail(email string) (*models.User, error)
	FindByUsername(username string) (*models.User, error)
	Exists(email string) bool
	ExistsUsername(username string) bool
	Delete(id string) error
	Update(u *models.User) error
}

UserRepository interface defines all functions that interact with the database

func NewUserRespository

func NewUserRespository(db *database.Postgres) UserRepository

NewUserRespository returns a new user repository

Jump to

Keyboard shortcuts

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