Documentation ¶
Index ¶
Constants ¶
const Defaults = `` /* 273-byte string literal not displayed */
Defaults is a string representation of the default configuration for Linker. This can be used in a JSON file to configure a Linker instance.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Linker ¶
Linker is a struct that contains the web service and SQL queries that support the Linker URL shortener.
func New ¶
New creates a new Linker instance and attempts to gather the initial configuration from a JSON formatted file. The path to this file can be passed in the string argument or read from the "LINKER_CONFIG" environment variable.
This function will return an error if the load could not happen on the configuration file is invalid.
func (*Linker) Add ¶
Add will attempt to add a redirect with the name of the first string to the URL provided in the second string argument.
This function will return an error if the add fails.
func (*Linker) Close ¶
Close will attempt to close the connection to the database and stop any running services associated with the Linker struct.
func (*Linker) Delete ¶
Delete will attempt to remove the redirect name and URL using the mapping name.
This function will return an error if the deletion fails. This function will pass even if the URL does not exist.
func (*Linker) List ¶
List will gather and print all the current link dataset.
This function returns an error if there is an error reading from the database.