db

package
v0.0.0-...-724514a Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DialectNotSupported = errors.New("Dialect not supported. [sqlite, postgres]")

Functions

This section is empty.

Types

type DB

type DB struct {
	DB *gorm.DB
}

func (*DB) AuthenticateUser

func (m *DB) AuthenticateUser(email, password string) (*models.User, error)

func (*DB) Connect

func (d *DB) Connect(dialect string, dsn string) error

func (*DB) CreateIfNotExists

func (m *DB) CreateIfNotExists(name string) (*models.Tag, error)

CreateIfNotExists gets a single tag from the DB or create it if it doesn't exist

func (*DB) GetBookmark

func (m *DB) GetBookmark(id uint, user *models.User) (*models.Bookmark, error)

GetBookmark gets a single bookmark from the DB

func (*DB) GetBookmarks

func (m *DB) GetBookmarks(user *models.User) ([]*models.Bookmark, error)

GetBookmarks gets all bookmarks

func (*DB) GetTag

func (m *DB) GetTag(id uint) (*models.Tag, error)

Get gets a single tag from the DB

func (*DB) GetTagByName

func (m *DB) GetTagByName(name string, user *models.User) (*models.Tag, error)

Get gets a single tag from the DB by name

func (*DB) GetTags

func (m *DB) GetTags(user *models.User) ([]*models.Tag, error)

GetTags gets all tags from the DB

func (*DB) GetUser

func (m *DB) GetUser(id uint) (*models.User, error)

func (*DB) InsertBookmark

func (m *DB) InsertBookmark(bookmark *models.Bookmark) error

InsertBookmark adds a bookmark to the DB

func (*DB) InsertTag

func (m *DB) InsertTag(tag *models.Tag) (uint, error)

Insert adds an tag to the DB

func (*DB) InsertUser

func (m *DB) InsertUser(name, email, password string) error

func (*DB) LatestBookmarks

func (m *DB) LatestBookmarks() ([]*models.Bookmark, error)

LatestBookmarks gets the 100 most recent bookmarks from the DB

func (*DB) LatestTags

func (m *DB) LatestTags() ([]*models.Tag, error)

Latest gets the 10 most recent tags from the DB

func (*DB) Migrate

func (d *DB) Migrate() error

func (*DB) UpdateBookmark

func (m *DB) UpdateBookmark(bookmark *models.Bookmark) error

UpdateBookmark updates a single bookmark in the DB

Jump to

Keyboard shortcuts

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