ursh

package module
v0.0.0-...-23b40fe Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2017 License: GPL-3.0 Imports: 6 Imported by: 0

README

ursh

Study case: URL shortener service

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Storage struct {
		Host     string
		Port     int
		User     string
		Password string
	}
	ExpireTime int `yaml:"expire_time"`
	UIPort     int
}

Config is a configuration struct

func Parse

func Parse(filename string) *Config

Parse parses the config file

type Storage

type Storage struct {
	Client redis.UniversalClient
}

Storage struct

func Connect

func Connect(host string, port int, user string, password string) (*Storage, error)

Connect to a Storage

func (*Storage) Get

func (s *Storage) Get(shortURL string) (*URL, error)

Get long URL using short URL

func (*Storage) Put

func (s *Storage) Put(u *URL, e time.Duration) error

Put URL struct to Storage

type URL

type URL struct {
	ShortURL string
	URL      string
}

URL is a struct to store short URLs and all the other stuff

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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