storage

package
v0.0.0-...-c09693c Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeStore

func InitializeStore(ctx context.Context, sqlDriver, conn string, l *log.Logger, maxIdleConns int, maxConnLifetime time.Duration) *sql.DB

InitializeStore initializes a sql connection to a given connection

Types

type Repository

type Repository interface {
	// ExpandShortURL returns the stored full URL value for the given short path
	ExpandShortURL(context.Context, string) (string, error)
	// RegisterURLMapping registers the first string as the long value URL on the second string short path.
	// Emits an error if parameters are invalid or registration fails
	RegisterURLMapping(context.Context, string, string) error
	// ClearMappingWithKey removes the any expension on the given key.
	// Emits an error if the removal fails
	ClearMappingWithKey(context.Context, string) error
}

Repository defines an interface for interacting with the MySQL instances

func NewSQLStore

func NewSQLStore(db *sql.DB) Repository

NewSQLStore constructs a new sqlStore

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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