database

package
v0.0.0-...-0aa7e3c Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: MIT Imports: 4 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 {
	*sql.DB
}

func NewDB

func NewDB(dbPath string) (*DB, error)

func (*DB) CreateUser

func (db *DB) CreateUser(username, email, password string) (*User, error)

func (*DB) DeleteURL

func (db *DB) DeleteURL(id int64) error

func (*DB) GetURL

func (db *DB) GetURL(key string) (*URL, error)

func (*DB) GetURLByID

func (db *DB) GetURLByID(id int64) (*URL, error)

func (*DB) GetURLsByUserID

func (db *DB) GetURLsByUserID(userID int64) ([]URL, error)

func (*DB) GetUserByUsername

func (db *DB) GetUserByUsername(username string) (*User, error)

func (*DB) IncrementClicks

func (db *DB) IncrementClicks(urlID int64) error

func (*DB) InsertURL

func (db *DB) InsertURL(url, key string, userID int64, password string, qrCode string) error

func (*DB) UpdateURL

func (db *DB) UpdateURL(id int64, url string, password string) error

type URL

type URL struct {
	ID        int64
	UserID    int64
	URL       string
	Key       string
	CreatedAt time.Time
	Clicks    int
	Password  string
	QRCode    string
}

type User

type User struct {
	ID       int64
	Username string
	Email    string
	Password string
}

Jump to

Keyboard shortcuts

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