entity

package
v0.0.0-...-e928be9 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Url

type Url string

Url is the long url the is associated with the token

func (Url) String

func (u Url) String() string

String will return the string representation of the url

func (Url) Validate

func (u Url) Validate() error

Validate will check if the url is valid

type UrlEntry

type UrlEntry struct {
	Url        Url      // The long url
	Token      UrlToken // The token is a short string that will be used to access the long url
	VisitCount int      // The number of times the url has been visited
}

UrlEntry is the domain entity that will store the long url, token, and the number of times the url has been visited

func NewUrlEntry

func NewUrlEntry(url string, token string, visitCount int) *UrlEntry

NewUrlEntry will create a new url entry from primitive types

type UrlToken

type UrlToken string

UrlToken is a short string that will be used to access the long url. This token is 8 characters long and can be and upper or lower case letter or a number

func NewUrlToken

func NewUrlToken() UrlToken

NewUrlToken will generate a new url token that is 8 characters long.

func (UrlToken) String

func (t UrlToken) String() string

String will return the string representation of the token

func (UrlToken) Validate

func (t UrlToken) Validate() error

Validate will check if the token is valid

Jump to

Keyboard shortcuts

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