shortener

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorShortLinkNotFound = errors.New("ShortLink: NOT FOUND")
	ErrorShortLinkInvalid  = errors.New("ShortLink: INVALID")
)

Functions

This section is empty.

Types

type ShortLink struct {
	Code      string `json:"code" bson:"code" msgpack:"code"`
	URL       string `json:"url" bson:"url" msgpack:"url" validate:"empty=false & format=url"`
	CreatedAt int64  `json:"created_at" bson:"created_at" msgpack:"created_at"`
}

type ShortLinkRepository

type ShortLinkRepository interface {
	Find(code *string) (*ShortLink, error)
	Store(shortlink *ShortLink) error
}

type ShortLinkSerializer

type ShortLinkSerializer interface {
	Decode(input []byte) (*ShortLink, error)
	Encode(input *ShortLink) ([]byte, error)
}

type ShortLinkService

type ShortLinkService interface {
	Find(code string) (*ShortLink, error)
	Store(shortlink *ShortLink) error
}

func NewShortLinkService

func NewShortLinkService(shortLinkRepository ShortLinkRepository) ShortLinkService

Jump to

Keyboard shortcuts

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