database

package
v0.0.0-...-4effd02 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: GPL-3.0 Imports: 7 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 {
	Connect() error
	CheckConnection() error
	MakeMigrations() error

	GetTokenByUser(models.User) (models.Token, error)
	GetTokenById(int) (models.Token, error)
	GetTokenByToken(string) (models.Token, error)
	CreateToken(models.Token) (models.Token, error)
	DeleteToken(models.Token) error

	GetUserByCredentials(string, string) (models.User, error)
	GetUserById(int) (models.User, error)
	CreateUser(models.User) (models.User, error)
	UpdateUser(models.User) (models.User, error)
	DeleteUser(models.User) error

	GetLinkById(int) (models.Link, error)
	GetLinksByUser(models.User) ([]models.Link, error)
	GetLinkByShortURL(string) (models.Link, error)
	CreateLink(models.Link) (models.Link, error)
	UpdateLink(models.Link) (models.Link, error)
	DeleteLink(models.Link) error
}

type PostgresDB

type PostgresDB struct {
	Username string
	Password string
	DBName   string
	Address  string
	SSLMode  string
	// contains filtered or unexported fields
}

func (*PostgresDB) CheckConnection

func (db *PostgresDB) CheckConnection() error

func (*PostgresDB) Connect

func (db *PostgresDB) Connect() error
func (db *PostgresDB) CreateLink(link models.Link) (models.Link, error)

func (*PostgresDB) CreateToken

func (db *PostgresDB) CreateToken(token models.Token) (models.Token, error)

func (*PostgresDB) CreateUser

func (db *PostgresDB) CreateUser(user models.User) (models.User, error)
func (db *PostgresDB) DeleteLink(link models.Link) error

func (*PostgresDB) DeleteToken

func (db *PostgresDB) DeleteToken(token models.Token) error

func (*PostgresDB) DeleteUser

func (db *PostgresDB) DeleteUser(user models.User) error

func (*PostgresDB) GetLinkById

func (db *PostgresDB) GetLinkById(id int) (models.Link, error)

func (*PostgresDB) GetLinkByShortURL

func (db *PostgresDB) GetLinkByShortURL(short string) (models.Link, error)

func (*PostgresDB) GetLinksByUser

func (db *PostgresDB) GetLinksByUser(user models.User) ([]models.Link, error)

func (*PostgresDB) GetTokenById

func (db *PostgresDB) GetTokenById(id int) (models.Token, error)

func (*PostgresDB) GetTokenByToken

func (db *PostgresDB) GetTokenByToken(t string) (models.Token, error)

func (*PostgresDB) GetTokenByUser

func (db *PostgresDB) GetTokenByUser(user models.User) (models.Token, error)

func (*PostgresDB) GetUserByCredentials

func (db *PostgresDB) GetUserByCredentials(username, password string) (models.User, error)

func (*PostgresDB) GetUserById

func (db *PostgresDB) GetUserById(id int) (models.User, error)

func (*PostgresDB) MakeMigrations

func (db *PostgresDB) MakeMigrations() error
func (db *PostgresDB) UpdateLink(link models.Link) (models.Link, error)

func (*PostgresDB) UpdateUser

func (db *PostgresDB) UpdateUser(user models.User) (models.User, error)

Jump to

Keyboard shortcuts

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