Documentation ¶
Index ¶
- type SQLiteRepository
- func (r *SQLiteRepository) Close() error
- func (r *SQLiteRepository) CodeExists(code string) (bool, error)
- func (r *SQLiteRepository) Create(url *models.URL) error
- func (r *SQLiteRepository) DeleteOldURLs(age time.Duration) error
- func (r *SQLiteRepository) GetByCode(code string) (*models.URL, error)
- func (r *SQLiteRepository) GetByOriginalURL(originalURL string) (*models.URL, error)
- func (r *SQLiteRepository) GetRecentURLs(limit int) ([]*models.URL, error)
- func (r *SQLiteRepository) GetStats() (*models.Stats, error)
- func (r *SQLiteRepository) IncrementVisits(code string) error
- type URLRepository
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) 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) 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 }
Click to show internal directories.
Click to hide internal directories.