Documentation
¶
Index ¶
- Variables
- func SetupTestDB(t *testing.T, tokenForAdmin string) (*sql.DB, func(...string))
- func TestDB(t *testing.T, databasePath string) (*sql.DB, func(...string))
- type LinkRepository
- func (l *LinkRepository) Create(ctx context.Context, UID int, originLink string, preferredLink string) (*models.Link, error)
- func (l *LinkRepository) Delete(ctx context.Context, originLink string) error
- func (l *LinkRepository) GetByOriginLink(ctx context.Context, originLink string) (*models.Link, error)
- func (l *LinkRepository) GetByShortLink(ctx context.Context, shortLink string) (*models.Link, error)
- func (l *LinkRepository) GetByUID(ctx context.Context, uid int) ([]*models.Link, error)
- func (l *LinkRepository) ReActivate(ctx context.Context, originLink string) error
- func (l *LinkRepository) ShortLinkExist(ctx context.Context, shortLink string) (bool, error)
- type Store
- type UserRepository
- func (u *UserRepository) CheckByToken(ctx context.Context, token string) (bool, error)
- func (u *UserRepository) Create(ctx context.Context) (*models.User, error)
- func (u *UserRepository) Delete(ctx context.Context, unique interface{}) error
- func (u *UserRepository) GetByRole(ctx context.Context, role string, limit int, offset int) ([]models.User, error)
- func (u *UserRepository) GetByToken(ctx context.Context, token string) (*models.User, error)
- func (u *UserRepository) GetByUID(ctx context.Context, uid int) (*models.User, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( InvalidLinkError = errors.New("The passed link is not valid") ExistLinkError = errors.New("The desired link already exists") )
Functions ¶
Types ¶
type LinkRepository ¶
type LinkRepository struct {
ExpDuration time.Duration
DelDuration time.Duration
// contains filtered or unexported fields
}
func (*LinkRepository) Create ¶
func (l *LinkRepository) Create(ctx context.Context, UID int, originLink string, preferredLink string) (*models.Link, error)
Заменить вызов двух функций на транзакцию
func (*LinkRepository) Delete ¶
func (l *LinkRepository) Delete(ctx context.Context, originLink string) error
func (*LinkRepository) GetByOriginLink ¶
func (*LinkRepository) GetByShortLink ¶
func (*LinkRepository) ReActivate ¶
func (l *LinkRepository) ReActivate(ctx context.Context, originLink string) error
func (*LinkRepository) ShortLinkExist ¶
type Store ¶
func (*Store) Link ¶
func (s *Store) Link() store.LinkRepository
func (*Store) User ¶
func (s *Store) User() store.UserRepository
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
func (*UserRepository) CheckByToken ¶
func (*UserRepository) Delete ¶
func (u *UserRepository) Delete(ctx context.Context, unique interface{}) error
func (*UserRepository) GetByToken ¶
Click to show internal directories.
Click to hide internal directories.