Documentation ¶
Index ¶
- type ShortlinkService
- func (ss *ShortlinkService) GenerateSlug() (string, error)
- func (ss *ShortlinkService) GetBySlug(slug string) (*entities.Shortlink, error)
- func (ss *ShortlinkService) HashPassword(plaintextPassword string) (string, error)
- func (ss *ShortlinkService) SaveShortlink(shortlink *entities.Shortlink) (*entities.Shortlink, error)
- func (ss *ShortlinkService) ValidateKind(kind string) error
- func (ss *ShortlinkService) ValidatePasswordLength(password string) error
- func (ss *ShortlinkService) ValidateUserSlug(slug string) error
- func (ss *ShortlinkService) VerifyPassword(hashedPassword, plaintextPassword string) bool
- type VisitService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ShortlinkService ¶
ShortlinkService manages shortlinks.
func (*ShortlinkService) GenerateSlug ¶
func (ss *ShortlinkService) GenerateSlug() (string, error)
GenerateSlug generates a random URL-encoded shortlink slug, ensuring uniqueness with DB.
func (*ShortlinkService) GetBySlug ¶
func (ss *ShortlinkService) GetBySlug(slug string) (*entities.Shortlink, error)
GetBySlug retrieves the main parts of a shortlink by its slug.
func (*ShortlinkService) HashPassword ¶
func (ss *ShortlinkService) HashPassword(plaintextPassword string) (string, error)
HashPassword generates a bcrypt hash of a plaintext password.
func (*ShortlinkService) SaveShortlink ¶
func (ss *ShortlinkService) SaveShortlink(shortlink *entities.Shortlink) (*entities.Shortlink, error)
SaveShortlink writes a shortlink to the DB.
func (*ShortlinkService) ValidateKind ¶
func (ss *ShortlinkService) ValidateKind(kind string) error
ValidateKind checks if a kind is supported.
func (*ShortlinkService) ValidatePasswordLength ¶
func (ss *ShortlinkService) ValidatePasswordLength(password string) error
ValidatePasswordLength checks if a password's length is valid.
func (*ShortlinkService) ValidateUserSlug ¶
func (ss *ShortlinkService) ValidateUserSlug(slug string) error
ValidateUserSlug checks if a user-provided slug meets all requirements.
func (*ShortlinkService) VerifyPassword ¶
func (ss *ShortlinkService) VerifyPassword(hashedPassword, plaintextPassword string) bool
VerifyPassword compares a bcrypt hash with a plaintext password.
Click to show internal directories.
Click to hide internal directories.