sqlite

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: CC-BY-SA-4.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(ctx context.Context, dsn string) (*sql.DB, error)

Dial connects to SQLite and applies the schema for convenience.

func DialTestDB

func DialTestDB(tb testing.TB) *sql.DB

DialTestDB connects to a unique in-memory SQLite database.

Types

type Shortener

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

Shortener is a link shortener service that is backed by SQLite.

func NewShortener

func NewShortener(db *sql.DB) *Shortener

NewShortener returns a new Shortener service.

func (*Shortener) Resolve

func (s *Shortener) Resolve(ctx context.Context, key link.Key) (link.Link, error)

Resolve resolves a link.Link by its link.Key from the database.

func (*Shortener) Shorten

func (s *Shortener) Shorten(ctx context.Context, lnk link.Link) (link.Key, error)

Shorten shortens the URL of the link.Link and returns a link.Key.

Jump to

Keyboard shortcuts

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