db

package
v0.0.0-...-e14a4cb Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: MIT Imports: 8 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 {
	*gorm.DB
}

func NewDB

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

NewDB returns a new DB connection.

func (db *DB) CreateLink(link *model.Link) error

func (*DB) CreateUser

func (db *DB) CreateUser(user *model.User) error

CreateUser inserts a new user into the database.

func (*DB) CreateVote

func (db *DB) CreateVote(vote *model.Vote) error

func (*DB) GetLinkById

func (db *DB) GetLinkById(id uint) (*model.Link, error)

func (*DB) GetUserByEmail

func (db *DB) GetUserByEmail(email string) (*model.User, error)

GetUserByEmail returns the user with the specified email address from the database.

func (*DB) GetUserById

func (db *DB) GetUserById(id uint) (*model.User, error)

func (*DB) GetUserFromToken

func (db *DB) GetUserFromToken(tokenString string) (*model.User, error)

func (*DB) GetVoteById

func (db *DB) GetVoteById(id uint) (*model.Vote, error)

func (*DB) GetVotesByLinkId

func (db *DB) GetVotesByLinkId(linkId uint) ([]*model.Vote, error)

func (*DB) SearchLinksByDescription

func (db *DB) SearchLinksByDescription(search string) ([]*model.Link, error)

func (*DB) SearchLinksByUrl

func (db *DB) SearchLinksByUrl(search string) ([]*model.Link, error)

Jump to

Keyboard shortcuts

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