db

package
v0.0.0-...-8c61d13 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connection

func Connection(c *m.Config) string

Connection creates the connection string and returns it.

Types

type DB

type DB struct {
	Conn *gorm.DB
}

DB is the top-level Database instance.

func (*DB) Archived

func (d *DB) Archived(hash string)

func (*DB) CheckTemp2FAToken

func (d *DB) CheckTemp2FAToken(t string) bool

CheckTemp2FAToken checks the temp 2FA token and its expiration timestamp

func (*DB) DefaultSettings

func (d *DB) DefaultSettings() m.Settings

func (*DB) GetBookmarkByHash

func (d *DB) GetBookmarkByHash(hash string) m.Entity

func (*DB) GetBookmarks

func (d *DB) GetBookmarks(id uint) []m.Entity

func (*DB) GetFolders

func (d *DB) GetFolders(id uint) []m.Folder

func (*DB) GetRecentBookmarks

func (d *DB) GetRecentBookmarks(id uint) []m.Entity

func (*DB) GetShared

func (d *DB) GetShared(shareHash string) m.Entity

func (*DB) GetSubEntities

func (d *DB) GetSubEntities(hash string, id uint) []m.Folder

func (*DB) GetSubFolders

func (d *DB) GetSubFolders(hash string, id uint) []m.Folder

func (*DB) Init

func (d *DB) Init(c *m.Config)

Init sets up the Database connection. This function will panic if the connection isn't possible.

func (*DB) LoadSettings

func (d *DB) LoadSettings() m.Settings

func (*DB) Register

func (d *DB) Register(user, pass, last, first, mail string) error

func (*DB) SaveBookmarkToFolder

func (d *DB) SaveBookmarkToFolder(parentHash string, b m.Bookmark) error

func (*DB) SaveEntity

func (d *DB) SaveEntity(e m.Entity)

func (*DB) SaveFolder

func (d *DB) SaveFolder(f m.Folder)

func (*DB) SaveSubFolder

func (d *DB) SaveSubFolder(parentHash string, sub m.Folder) error

func (*DB) SetTemp2FAToken

func (d *DB) SetTemp2FAToken(u *m.User, t string, expirationTime time.Time) error

SetTempTwoFAToken sets a temp 2FA token and its expiration timestamp

func (*DB) ShareBookmark

func (d *DB) ShareBookmark(hash string) (string, error)

func (*DB) Update2FA

func (d *DB) Update2FA(username, key string) error

func (*DB) ValidateCredentials

func (d *DB) ValidateCredentials(username, inputPass string) (bool, m.User)

func (*DB) ValidateNewCredentials

func (d *DB) ValidateNewCredentials(u, p string) bool

Jump to

Keyboard shortcuts

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