entity

package
v0.0.0-...-4e1f151 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

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

func ErrInternal(message string) error

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.

Jump to

Keyboard shortcuts

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