mapper

package
v0.0.0-...-c490ea4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package mapper contains code which will convert an incoming URL request path into a URL to redirect the client to.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mapper

type Mapper struct {
	// contains filtered or unexported fields
}

Mapper implements the lookup logic. It supports a limited form of path-segment and query-parameter mapping.

func New

func New() *Mapper

New constructs an empty Mapper.

func (*Mapper) Get

func (m *Mapper) Get(request *url.URL) (_ *db.Link, ok bool)

Get resolves an incoming request URL to a short link to redirect the caller to.

func (m *Mapper) SetLinks(links []*db.Link)

SetLinks updates the internal state of the Mapper with a new collection of short links. This method does not require external synchronization.

Jump to

Keyboard shortcuts

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