services

package
v0.0.0-...-4bc35ca Latest Latest
Warning

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

Go to latest
Published: Apr 26, 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 ArticleRepo

type ArticleRepo struct {
	DB *pg.DB
}

func (*ArticleRepo) CreateArticle

func (a *ArticleRepo) CreateArticle(ctx context.Context, user *models.User, input models.NewArticle) (*models.Article, error)

func (*ArticleRepo) DeleteArticle

func (a *ArticleRepo) DeleteArticle(ctx context.Context, id string) (bool, error)

func (*ArticleRepo) GetArticleByID

func (a *ArticleRepo) GetArticleByID(ctx context.Context, id string) (*models.Article, error)

func (*ArticleRepo) GetArticles

func (a *ArticleRepo) GetArticles(ctx context.Context, filter *models.ArticleFilter, first, offset *int) ([]*models.Article, error)

func (*ArticleRepo) GetArticlesByUserIDs

func (a *ArticleRepo) GetArticlesByUserIDs(ids []string) ([][]*models.Article, []error)

func (*ArticleRepo) UpdateArticle

func (a *ArticleRepo) UpdateArticle(ctx context.Context, id string, input models.UpdateArticle) (*models.Article, error)

type AuthRepo

type AuthRepo struct {
	DB              *pg.DB
	TokenController tokenController
}

func (*AuthRepo) Authenticate

func (a *AuthRepo) Authenticate(ctx context.Context, login models.LoginInput) (string, error)

type ImageRepo

type ImageRepo struct {
	DB *pg.DB
}

func (*ImageRepo) CreateImage

func (i *ImageRepo) CreateImage(ctx context.Context, input models.NewImage) (*models.Image, error)

func (*ImageRepo) DeleteImage

func (i *ImageRepo) DeleteImage(ctx context.Context, id string) (bool, error)

func (*ImageRepo) GetImageByID

func (i *ImageRepo) GetImageByID(ctx context.Context, id string) (*models.Image, error)

func (*ImageRepo) GetImageBySlug

func (i *ImageRepo) GetImageBySlug(ctx context.Context, slug string) (*models.Image, error)

func (*ImageRepo) GetImages

func (i *ImageRepo) GetImages(ctx context.Context, filter *models.ImageFilter, first, offset *int) ([]*models.Image, error)

func (*ImageRepo) UpdateImage

func (i *ImageRepo) UpdateImage(ctx context.Context, id string, input models.UpdateImage) (*models.Image, error)

type Repos

type Repos struct {
	UserRepo
	ArticleRepo
	AuthRepo
	ImageRepo
}

func NewRepos

func NewRepos(db *pg.DB, tc tokenController) *Repos

type UserRepo

type UserRepo struct {
	DB *pg.DB
}

func (*UserRepo) CreateUser

func (u *UserRepo) CreateUser(ctx context.Context, input models.NewUser) (*models.User, error)

func (*UserRepo) DeleteUser

func (u *UserRepo) DeleteUser(ctx context.Context, id string) (bool, error)

func (*UserRepo) GetUserByEmail

func (u *UserRepo) GetUserByEmail(ctx context.Context, email string) (*models.User, error)

func (*UserRepo) GetUserByID

func (u *UserRepo) GetUserByID(ctx context.Context, id string) (*models.User, error)

func (*UserRepo) GetUsers

func (u *UserRepo) GetUsers(ctx context.Context, filter *models.UserFilter, first, offset *int) ([]*models.User, error)

func (*UserRepo) GetUsersByIDs

func (u *UserRepo) GetUsersByIDs(ids []string) ([]*models.User, []error)

func (*UserRepo) UpdateUser

func (u *UserRepo) UpdateUser(ctx context.Context, id string, input models.UpdateUser) (*models.User, error)

Jump to

Keyboard shortcuts

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