model

package
v0.0.0-...-31d6f92 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DetailInfo

type DetailInfo struct {
	Short               string        `json:"short"`
	Full                string        `json:"full"`
	CreatedAt           string        `json:"created_at"`
	ExpirationInMinutes time.Duration `json:"expiration_in_minutes"`
}

DetailInfo contains the detail of the shortlink

type RedisCli

type RedisCli struct {
	Cli *redis.Client
}

RedisCli is a redis client

func NewRedisCli

func NewRedisCli(addr string, passwd string, db int) *RedisCli

NewRedisCli creates a new redis client

func (*RedisCli) ShortLinkInfo

func (r *RedisCli) ShortLinkInfo(eid string) (*DetailInfo, error)

ShortLinkInfo gets ShortlinkDetailKey from redis

func (*RedisCli) Shorten

func (r *RedisCli) Shorten(url string, exp int64) (string, error)

Shorten convert url to shortlink

type RedisStorage

type RedisStorage interface {
	Shorten(url string, exp int64) (string, error)
	ShortLinkInfo(eid string) (*DetailInfo, error)
}

RedisStorage defined redis storage interface

Jump to

Keyboard shortcuts

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