Documentation ¶
Overview ¶
Package entity defines all structs that flowing through all application layers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrAlreadyExists ¶
func ErrAlreadyExists() error
ErrAlreadyExists returns codes.AlreadyExists. It explains that the code / short URL already exists.
func ErrEmptyURL ¶
func ErrEmptyURL() error
ErrEmptyURL returns codes.InvalidArgument. It explains that the instance is empty or nil.
func ErrInternal ¶
ErrInternal returns codes.Internal. It explains that unexpected behavior occurred in system.
func ErrNotFound ¶
func ErrNotFound() error
ErrNotFound returns codes.NotFound. It explains that short URL is not found.
func ErrURLTooLong ¶
func ErrURLTooLong() error
ErrURLTooLong returns codes.InvalidArgument. It explains that original URL's length exceeds 65535.
Types ¶
type URL ¶
type URL struct { // Code is a unique code for short URL. // ShortURL is built using this code, prefixed by domain. Code string // ShortURL is a shortened version of original URL created by the system. ShortURL string // OriginalURL is a raw URL from user. OriginalURL string // ExpireAt defines the expire time of the URL. // URL can only be accessed if current time is still smaller than expired time. ExpiredAt time.Time // CreatedAt defines when the URL was created. CreatedAt time.Time }
URL defines the logical data of an URL.
Click to show internal directories.
Click to hide internal directories.