db

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB contains database data.

func (*DB) Close

func (d *DB) Close() error

Close closes the underlying database connection.

func (*DB) Delete

func (d *DB) Delete(shortID string) (err error)

Delete removes a URL by shortID.

func (*DB) Get

func (d *DB) Get(shortID string) (url string, err error)

Get retrieves a URL by shortID.

func (*DB) Init

func (d *DB) Init() (err error)

Init initializes the database.

func (*DB) Stats

func (d *DB) Stats() (stats Stats)

Stats returns database stats.

func (*DB) Store

func (d *DB) Store(url string) (shortID string, err error)

Store stores a URL, and returns a shortID.

type Stats

type Stats struct {
	// Count contains the number of URLs stored.
	Count int
}

Stats contains database statistics.

Jump to

Keyboard shortcuts

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