spacesstateless

package
v3.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AccessKey string
	SecretKey string
	Region    string
	Space     string
	Path      string

	CacheDuration time.Duration
}

Config contains the configuration for the file storage

type Provider

type Provider struct {
	Config *Config
	// contains filtered or unexported fields
}

Provider implements an in memory storage that persists on DigitalOcean Spaces

func New

func New(c *Config) (*Provider, error)

New returns a new Provider instance

func (*Provider) Exists

func (p *Provider) Exists(alias string) (bool, error)

Exists checks if there is a URL with the requested alias

func (*Provider) Get

func (p *Provider) Get(alias string) (string, error)

Get attempts to find a URL by its alias and returns its original URL

func (*Provider) Store

func (p *Provider) Store(url, alias string) error

Store creates a new short URL

Jump to

Keyboard shortcuts

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