Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CodeGenerationOutcome ¶
type CodeGenerationOutcome int
The outcome of code generation.
const ( NewLink CodeGenerationOutcome = iota ExistingLink )
type CodeGenerationResult ¶
type CodeGenerationResult struct { ShortCode string Result CodeGenerationOutcome Err error }
The result of code generation.
func GenerateCode ¶
func GenerateCode(url string, rdb *redis.Client) (*CodeGenerationResult, error)
GenerateCode generates a shortcode for the given URL. If the URL already has a shortcode, the existing shortcode is returned. If the URL does not have a shortcode, a new shortcode is generated and returned. If an error occurs, an empty string and an error are returned.
type HashCollisionError ¶
type HashCollisionError string
Error when there is a hash collision
func (HashCollisionError) Error ¶
func (e HashCollisionError) Error() string
type InvalidURLError ¶
type InvalidURLError string
Error when there is an invalid URL
func (InvalidURLError) Error ¶
func (e InvalidURLError) Error() string
Click to show internal directories.
Click to hide internal directories.