handler

package
v0.0.0-...-a5936d2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MessageIncorrectFormat = "Incorrect request format!"
View Source
const MessageIncorrectPeriod = "Incorrect time limit!"
View Source
const MessageIncorrectUrl = "Incorrect URL format!"
View Source
const MessageInternalError = "Internal server error!"
View Source
const MessageNotFound = "URL not found!"
View Source
const MessageRunning = "Goshort running!"

Variables

This section is empty.

Functions

func Find

func Find(c *gin.Context)

func GetShortUrl

func GetShortUrl(l int) (string, error)

func Limit

func Limit(c *gin.Context)

func Shorten

func Shorten(c *gin.Context)

func Status

func Status(c *gin.Context)

Types

type FullUrl

type FullUrl struct {
	FullUrl string `json:"full_url"`
}

func GetFullUrlBody

func GetFullUrlBody(c *gin.Context) (FullUrl, error)

type LimitReq

type LimitReq struct {
	FullUrl      string `json:"full_url"`
	MinutesValid int    `json:"minutes_valid"`
}

func GetLimitBody

func GetLimitBody(c *gin.Context) (LimitReq, error)

type LimitRes

type LimitRes struct {
	ShortUrl   string    `json:"short_url"`
	CreatedAt  time.Time `json:"created_at"`
	ValidUntil time.Time `json:"valid_until"`
}

type ShortUrl

type ShortUrl struct {
	ShortUrl string `json:"short_url"`
}

Jump to

Keyboard shortcuts

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