model

package
v0.0.0-...-ff4c1db Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependencies

type Dependencies struct {
	URLService IURLService
}

type IURLService

type IURLService interface {
	InsertURL(ctx context.Context, url *URL) error
	ShortenURL(ctx context.Context, long LongURL) (ShortURL, error)
	GetURLByShort(ctx context.Context, short ShortURL) (*URL, error)
	GetURLByLong(ctx context.Context, long LongURL) (*URL, error)
}

type IURLStore

type IURLStore interface {
	CreateURL(ctx context.Context, url *URL) error
	QueryURL(ctx context.Context, id URLID) (*URL, error)
	QueryURLByShort(ctx context.Context, short ShortURL) (*URL, error)
	QueryURLByLong(ctx context.Context, long LongURL) (*URL, error)
}

type LongURL

type LongURL string

type ShortURL

type ShortURL string

type ShortenURLInput

type ShortenURLInput struct {
	URL string `json:"url"`
}

type URL

type URL struct {
	ID    URLID    `json:"id" db:"id"`
	Short ShortURL `json:"short_url" db:"short_url"`
	Long  LongURL  `json:"long_url" db:"long_url"`
}

func (*URL) ToBytes

func (u *URL) ToBytes() *bytes.Buffer

type URLID

type URLID string

Jump to

Keyboard shortcuts

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