url

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateURLShortCode

func CreateURLShortCode(input request.URLInput) (string, error)

CreateURLShortCode creates a new short code using request.URLInput It returns created short code or error if any.

func CreateURLShortCodeFromRequest

func CreateURLShortCodeFromRequest(req *http.Request) (string, error)

CreateURLShortCodeFromRequest creates a new short code for url given in http.Request It uses expires_on date and keywords from http.Request if available. It returns created short code or error if any.

func DeleteURLByShortCode

func DeleteURLByShortCode(shortCode string) error

DeleteURLByShortCode deletes url using short code It returns error on failure.

func DeleteURLFromRequest

func DeleteURLFromRequest(req *http.Request) error

DeleteURLFromRequest deletes url using short code from request It returns error on failure.

func IncrementHits

func IncrementHits(urlModel model.URL)

IncrementHits increments hit counter for given shortCode just before serving redirection

func ListURLsFiltered

func ListURLsFiltered(filter request.URLFilter) ([]model.URL, error)

ListURLsFiltered gets list of urls filtered using request.URLFilter It returns list of matching model.URL arrays and error if nothing matched.

func ListURLsFilteredFromRequest

func ListURLsFilteredFromRequest(req *http.Request) ([]model.URL, error)

ListURLsFilteredFromRequest gets list of urls filtered using http.Request query params It returns list of matching model.URL arrays and error if nothing matched.

func LookupOriginURL

func LookupOriginURL(shortCode string) (model.URL, int, bool)

LookupOriginURL looks up origin url from shortCode It returns origin url if exists and is active, http error code otherwise.

func ValidateURLInput

func ValidateURLInput(input request.URLInput) (string, error)

ValidateURLInput validates given request.URLInput It returns existing short code for input url if exists and validation error if any.

Types

This section is empty.

Jump to

Keyboard shortcuts

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