database

package
v0.0.0-...-fb96a0c Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	InsertURL(hash string, originalURL string) (URL, error)
	FindURL(hash string) (URL, error)
}

type PostgresStore

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

func NewPostgresStore

func NewPostgresStore(connString string) (*PostgresStore, error)

func (PostgresStore) DeleteURL

func (s PostgresStore) DeleteURL(hashedURL string) error

func (PostgresStore) FindURL

func (s PostgresStore) FindURL(hash string) (URL, error)

func (*PostgresStore) Init

func (s *PostgresStore) Init() error

func (PostgresStore) InsertURL

func (s PostgresStore) InsertURL(hash string, originalURL string) (URL, error)

type URL

type URL struct {
	Hash        string    `json:"hash"`
	OriginalURL string    `json:"hashedURL"`
	CreatedAt   time.Time `json:"createdAt"`
}

docker run --name some-postgres -e POSTGRES_PASSWORD=gobank -p 5432:5432 -d postgres

Jump to

Keyboard shortcuts

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