Documentation ¶
Index ¶
- type Database
- type PostgresDB
- func (db *PostgresDB) CheckConnection() error
- func (db *PostgresDB) Connect() error
- func (db *PostgresDB) CreateLink(link models.Link) (models.Link, error)
- func (db *PostgresDB) CreateToken(token models.Token) (models.Token, error)
- func (db *PostgresDB) CreateUser(user models.User) (models.User, error)
- func (db *PostgresDB) DeleteLink(link models.Link) error
- func (db *PostgresDB) DeleteToken(token models.Token) error
- func (db *PostgresDB) DeleteUser(user models.User) error
- func (db *PostgresDB) GetLinkById(id int) (models.Link, error)
- func (db *PostgresDB) GetLinkByShortURL(short string) (models.Link, error)
- func (db *PostgresDB) GetLinksByUser(user models.User) ([]models.Link, error)
- func (db *PostgresDB) GetTokenById(id int) (models.Token, error)
- func (db *PostgresDB) GetTokenByToken(t string) (models.Token, error)
- func (db *PostgresDB) GetTokenByUser(user models.User) (models.Token, error)
- func (db *PostgresDB) GetUserByCredentials(username, password string) (models.User, error)
- func (db *PostgresDB) GetUserById(id int) (models.User, error)
- func (db *PostgresDB) MakeMigrations() error
- func (db *PostgresDB) UpdateLink(link models.Link) (models.Link, error)
- func (db *PostgresDB) UpdateUser(user models.User) (models.User, error)
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 (*PostgresDB) CreateLink ¶
func (*PostgresDB) CreateToken ¶
func (*PostgresDB) CreateUser ¶
func (*PostgresDB) DeleteLink ¶
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 (*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 (*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 (*PostgresDB) UpdateLink ¶
func (*PostgresDB) UpdateUser ¶
Click to show internal directories.
Click to hide internal directories.