repository

package
v0.0.0-...-2cadb06 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCodeSendToMany         = cache.ErrSetCodeTooMany
	ErrCodeVerifyTooManyTimes = cache.ErrCodeVerifyTooManyTimes
)
View Source
var (
	ErrUserDuplicateEmail = dao.ErrUserDuplicateEmail
	ErrUserNotFound       = dao.ErrUserNotFound
)

Functions

This section is empty.

Types

type ArticleRepository

type ArticleRepository interface {
	Create(ctx context.Context, article *domain.Article) (int64, error)
	Update(ctx context.Context, article *domain.Article) error
	Sync(ctx context.Context, article *domain.Article) (int64, error)
	List(ctx context.Context, offset int, limit int) ([]domain.Article, error)
}

func NewArticleRepository

func NewArticleRepository(dao article.ArticleDao, cache cache.ArticleCache, logger *zap.Logger) ArticleRepository

type ArticleRepositoryImpl

type ArticleRepositoryImpl struct {
	// contains filtered or unexported fields
}

func (*ArticleRepositoryImpl) Create

func (repo *ArticleRepositoryImpl) Create(ctx context.Context, article *domain.Article) (int64, error)

func (*ArticleRepositoryImpl) List

func (repo *ArticleRepositoryImpl) List(ctx context.Context, offset int, limit int) ([]domain.Article, error)

func (*ArticleRepositoryImpl) Sync

func (repo *ArticleRepositoryImpl) Sync(ctx context.Context, article *domain.Article) (int64, error)

func (*ArticleRepositoryImpl) Update

func (repo *ArticleRepositoryImpl) Update(ctx context.Context, article *domain.Article) error

type CodeRepository

type CodeRepository interface {
	Store(ctx context.Context, biz, phone, code string) error
	Verify(ctx context.Context, biz, phone, inputCode string) (bool, error)
}

func NewCodeRepository

func NewCodeRepository(c *cache.CodeCache, l *zap.Logger) CodeRepository

type CodeRepositoryImpl

type CodeRepositoryImpl struct {
	// contains filtered or unexported fields
}

func (*CodeRepositoryImpl) Store

func (repo *CodeRepositoryImpl) Store(ctx context.Context, biz, phone, code string) error

func (*CodeRepositoryImpl) Verify

func (repo *CodeRepositoryImpl) Verify(ctx context.Context, biz, phone, inputCode string) (bool, error)

type InteractiveRepository

type InteractiveRepository interface {
	IncreaseReadCount(ctx context.Context, biz string, bizId int64) error
	IncreaseLikeCount(ctx context.Context, biz string, id int64, uid int64) error
}

type InteractiveRepositoryImpl

type InteractiveRepositoryImpl struct {
	// contains filtered or unexported fields
}

func NewInteractiveRepositoryImpl

func NewInteractiveRepositoryImpl() *InteractiveRepositoryImpl

func (*InteractiveRepositoryImpl) IncreaseLikeCount

func (repo *InteractiveRepositoryImpl) IncreaseLikeCount(ctx context.Context, biz string, id int64, uid int64) error

func (*InteractiveRepositoryImpl) IncreaseReadCount

func (repo *InteractiveRepositoryImpl) IncreaseReadCount(ctx context.Context, biz string, bizId int64) error

type UserRepository

type UserRepository interface {
	FindByEmail(ctx context.Context, email string) (domain.User, error)
	Create(ctx context.Context, user domain.User) error
	FindById(ctx context.Context, id int64) (domain.User, error)
	FindByPhone(ctx context.Context, phone string) (domain.User, error)
}

func NewUserRepository

func NewUserRepository(d dao.UserDao, c cache.UserCache, l *zap.Logger) UserRepository

type UserRepositoryImpl

type UserRepositoryImpl struct {
	// contains filtered or unexported fields
}

func (*UserRepositoryImpl) Create

func (r *UserRepositoryImpl) Create(ctx context.Context, u domain.User) error

func (*UserRepositoryImpl) Domain2Entity

func (r *UserRepositoryImpl) Domain2Entity(u domain.User) dao.User

func (*UserRepositoryImpl) Entity2Domain

func (r *UserRepositoryImpl) Entity2Domain(u dao.User) domain.User

func (*UserRepositoryImpl) FindByEmail

func (r *UserRepositoryImpl) FindByEmail(ctx context.Context, email string) (domain.User, error)

func (*UserRepositoryImpl) FindById

func (r *UserRepositoryImpl) FindById(ctx context.Context, id int64) (domain.User, error)

FindById 缺点:只要缓存返回了 error,就直接取数据库查询。

回写缓存的时候,忽略掉了错误

func (*UserRepositoryImpl) FindByPhone

func (r *UserRepositoryImpl) FindByPhone(ctx context.Context, phone string) (domain.User, error)

Directories

Path Synopsis
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
dao
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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