storage

package
v0.0.0-...-c902aac Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package storage provide abstract types to handle storage

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code string

Code is short code of URL, may include some special format.

func (Code) URL

func (c Code) URL(prefix string) string

URL return a url based on code

type Item

type Item struct {
	URL     string `json:"url"`
	Visited bool   `json:"visited"`
	Count   int    `json:"count"`
}

Item is type of origin URL.

type URLService

type URLService interface {

	// Save an URL, return short code and error
	Save(context.Context, string) (Code, error)

	// Use code to return URL
	Load(context.Context, Code) (string, error)

	// Return detailed info of code
	LoadInfo(context.Context, Code) (Item, error)
}

URLService is the Type to interact with Database

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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