links

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LinkMap

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

LinkMap houses the map of redirects, and keeps track of the backing file for maintaining the map across restarts. It also handles thread safety.

func NewLinkMap

func NewLinkMap(persistType storage.StorageType, requestedConfig string) *LinkMap

NewLinkMap generates a new LinkMap object, with the requested config if it exists. If the requested config does not exist, it falls back to the default locations. If the default locations do not exist, the program will exit with an error.

func (*LinkMap) Delete

func (l *LinkMap) Delete(key string) error

Delete removes an entry from the link map. If the key is not present in the map, this is a no-op

func (*LinkMap) Get

func (l *LinkMap) Get(key string) (string, bool)

Get returns the url and state of existence for a single key.

func (*LinkMap) GetAll

func (l *LinkMap) GetAll() map[string]string

GetAll returns a map containing all of the entries from the current LinkMap object

func (*LinkMap) GetAllKeys

func (l *LinkMap) GetAllKeys() []string

func (*LinkMap) GetFiltered

func (l *LinkMap) GetFiltered(keys []string) map[string]string

func (*LinkMap) Put

func (l *LinkMap) Put(key string, target *url.URL) error

Put appends a new entry to the link map. If the entry already exists, it will be duplicated in the backing file, and the value in the live map will be replaced.

func (*LinkMap) Update

func (l *LinkMap) Update(key string, target *url.URL) error

Update updates an existing entry in the link map. This should only be used to update existing entries, as Put is much more efficient for additions.

type ParseError

type ParseError struct{}

func (*ParseError) Error

func (e *ParseError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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