shortener

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

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

Go to latest
Published: Feb 26, 2015 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const Base10 = 10
View Source
const Base64 = 64

Variables

This section is empty.

Functions

func AliasHandler

func AliasHandler(rw http.ResponseWriter, r *http.Request)

func AliasMatcher

func AliasMatcher(r *http.Request, rm *mux.RouteMatch) bool

func BaseHandler

func BaseHandler(rw http.ResponseWriter, r *http.Request)

func BaseMatcher

func BaseMatcher(r *http.Request, rm *mux.RouteMatch) bool

func CalculateCheckDigit

func CalculateCheckDigit(partialId uint64) uint64

func CheckSum

func CheckSum(id uint64) uint64

func DecodeFromBase

func DecodeFromBase(encodedString string) (uint64, error)

func EncodeToBase

func EncodeToBase(seedNumber uint64) (string, error)

func ExtractBaseUrl

func ExtractBaseUrl(r *http.Request, c *redis.Client) (string, error)

func IsCheckSumValid

func IsCheckSumValid(id uint64) bool

func LookupAlias

func LookupAlias(alias string, c *redis.Client) (string, error)

func MultiMatcher

func MultiMatcher(r *http.Request, rm *mux.RouteMatch) bool

func RedirectToBaseHandler

func RedirectToBaseHandler(rw http.ResponseWriter, r *http.Request)

func RegisterAndStart

func RegisterAndStart(redisHost string, redisDatabase string, redisPort string, serverPort string, timeOutSeconds int)

func RootHandler

func RootHandler(rw http.ResponseWriter, r *http.Request)

func SetupRedisConnection

func SetupRedisConnection(serverHost string, serverDb string, serverport string, timeOutSeconds int) (*redis.Client, error)

func StoreUrl

func StoreUrl(baseUrl string, c *redis.Client) (string, error)

func ValidateAlias

func ValidateAlias(alias string) bool

Types

type UrlMsg

type UrlMsg struct {
	Url          string `json:shorturl`
	ErrorMessage string `json:errorMessage`
}

Jump to

Keyboard shortcuts

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