Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrRecordNotFound = errors.New("record not found")
ErrRecordNotFound represents an error for not finding an error in DB
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics struct { ErrCounter *prometheus.CounterVec Histogram *prometheus.HistogramVec }
Metrics keeps global Prometheus metrics.
type RedisURLCounterRepo ¶
RedisURLCounterRepo represent repository model for redis.
func (RedisURLCounterRepo) Decr ¶
func (r RedisURLCounterRepo) Decr(id uint64, count int64) (finalErr error)
Decr decreases the counter value each time a shorted URL is called.
func (RedisURLCounterRepo) Get ¶
func (r RedisURLCounterRepo) Get(key string) (_ int64, finalErr error)
Get returns value of a key.
func (RedisURLCounterRepo) Incr ¶
func (r RedisURLCounterRepo) Incr(id uint64) (finalErr error)
Incr increases a counter value each time a shorted URL is called.
func (RedisURLCounterRepo) Keys ¶
func (r RedisURLCounterRepo) Keys() (_ []string, finalErr error)
Keys returns all keys from redis.
type RedisURLRepo ¶ added in v1.1.0
type RedisURLRepo struct { Base URLRepo RedisMasterClient redis.Cmdable RedisSlaveClient redis.Cmdable }
RedisURLRepo represent repository model for redis cache.
func (RedisURLRepo) Create ¶ added in v1.1.0
func (r RedisURLRepo) Create(url *URL) error
Create creates a new shorted url in database.
type SQLURLRepo ¶
SQLURLRepo represents repository model for SQL databases.
func (SQLURLRepo) Create ¶
func (s SQLURLRepo) Create(url *URL) (finalErr error)
Create creates a new shorted url in database.
Click to show internal directories.
Click to hide internal directories.