links

package
v0.0.0-...-bfc4fd5 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Letters = "0123456789abcdefghijklmnopqrstuvwxyz"

Functions

This section is empty.

Types

type Collection

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

func NewCollection

func NewCollection(storage StorageInterface) *Collection

func (*Collection) GenerateKey

func (c *Collection) GenerateKey(URL string) (string, error)

func (*Collection) GenerateKeys

func (c *Collection) GenerateKeys(URLs []string) (map[string]string, error)

func (*Collection) GetURL

func (c *Collection) GetURL(key string) (string, error)

func (*Collection) GetURLs

func (c *Collection) GetURLs(keys []string) (map[string]string, error)

type FileStorage

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

func NewFileStorage

func NewFileStorage(filename string) (*FileStorage, error)

func (*FileStorage) GetURL

func (fs *FileStorage) GetURL(key string) (string, error)

func (*FileStorage) GetURLs

func (fs *FileStorage) GetURLs(keys []string) (map[string]string, error)

func (*FileStorage) Restore

func (fs *FileStorage) Restore() error

func (*FileStorage) StoreURLs

func (fs *FileStorage) StoreURLs(URLs []string) (map[string]string, error)

StoreURLs Returns map with key=URL, value=key

type FileStorageAsync

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

func NewFileStorageAsync

func NewFileStorageAsync(logger *utils.Logger, background *utils.Background, filename string) (*FileStorageAsync, error)

func (*FileStorageAsync) GetURL

func (fsa *FileStorageAsync) GetURL(key string) (string, error)

func (*FileStorageAsync) GetURLs

func (fsa *FileStorageAsync) GetURLs(keys []string) (map[string]string, error)

func (*FileStorageAsync) Restore

func (fsa *FileStorageAsync) Restore() error

func (*FileStorageAsync) StoreURLs

func (fsa *FileStorageAsync) StoreURLs(URLs []string) (map[string]string, error)

type SQLStorage

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

func NewSQLStorage

func NewSQLStorage(db *sql.DB, timeout int) *SQLStorage

func (*SQLStorage) GetURL

func (s *SQLStorage) GetURL(key string) (string, error)

func (*SQLStorage) GetURLs

func (s *SQLStorage) GetURLs(keys []string) (map[string]string, error)

func (*SQLStorage) StoreURLs

func (s *SQLStorage) StoreURLs(URLs []string) (map[string]string, error)

type StorageInterface

type StorageInterface interface {
	StoreURLs(URLs []string) (map[string]string, error)
	GetURL(string) (string, error)
	GetURLs([]string) (map[string]string, error)
}

Jump to

Keyboard shortcuts

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