repository

package
v0.0.0-...-15f6c86 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 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 SQLiteRepository

type SQLiteRepository struct {
	// contains filtered or unexported fields
}

func NewSQLiteRepository

func NewSQLiteRepository(dbPath string) (*SQLiteRepository, error)

func (*SQLiteRepository) Close

func (r *SQLiteRepository) Close() error

func (*SQLiteRepository) CodeExists

func (r *SQLiteRepository) CodeExists(code string) (bool, error)

For checking if a short code already exists

func (*SQLiteRepository) Create

func (r *SQLiteRepository) Create(url *models.URL) error

func (*SQLiteRepository) DeleteOldURLs

func (r *SQLiteRepository) DeleteOldURLs(age time.Duration) error

For cleanup/maintenance

func (*SQLiteRepository) GetByCode

func (r *SQLiteRepository) GetByCode(code string) (*models.URL, error)

func (*SQLiteRepository) GetByOriginalURL

func (r *SQLiteRepository) GetByOriginalURL(originalURL string) (*models.URL, error)

func (*SQLiteRepository) GetRecentURLs

func (r *SQLiteRepository) GetRecentURLs(limit int) ([]*models.URL, error)

func (*SQLiteRepository) GetStats

func (r *SQLiteRepository) GetStats() (*models.Stats, error)

func (*SQLiteRepository) IncrementVisits

func (r *SQLiteRepository) IncrementVisits(code string) error

type URLRepository

type URLRepository interface {
	Create(url *models.URL) error
	GetByOriginalURL(originalURL string) (*models.URL, error)
	GetByCode(code string) (*models.URL, error)
	IncrementVisits(code string) error
	GetRecentURLs(limit int) ([]*models.URL, error)
	GetStats() (*models.Stats, error)
	CodeExists(code string) (bool, error)
	DeleteOldURLs(age time.Duration) error
	Close() error
}

Jump to

Keyboard shortcuts

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