Documentation ¶
Index ¶
- func Connection(c *Config) string
- type Bookmark
- type Config
- type DB
- func (d *DB) CheckTemp2FAToken(t string) bool
- func (d *DB) DefaultSettings() Settings
- func (d *DB) GetBookmarksByUserID(id uint) []Bookmark
- func (d *DB) GetFolders(id uint) []Folder
- func (d *DB) GetSubEntities(hash string, id uint) []Folder
- func (d *DB) GetSubFolders(hash string, id uint) []Folder
- func (d *DB) Init(c *Config)
- func (d *DB) LoadSettings() Settings
- func (d *DB) Register(user, pass, last, first, mail string) error
- func (d *DB) SaveBookmark(b Bookmark)
- func (d *DB) SaveBookmarkToFolder(parentHash string, b Bookmark) error
- func (d *DB) SaveFolder(f Folder)
- func (d *DB) SaveSubFolder(parentHash string, sub Folder) error
- func (d *DB) SetTemp2FAToken(u *User, t string, expirationTime time.Time) error
- func (d *DB) Update2FA(username, key string) error
- func (d *DB) ValidateCredentials(username, inputPass string) (bool, User)
- func (d *DB) ValidateNewCredentials(u, p string) bool
- type DBModel
- type Entity
- type EntityRelation
- type Folder
- type Group
- type Note
- type Role
- type Settings
- type Tag
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connection ¶
Connection creates the connection string and returns it.
Types ¶
type Config ¶
type Config struct { Domain string `json:"domain"` WebRoot string `json:"web_root"` BaseURL string `json:"base_url"` UseSSL bool `json:"use_ssl"` DB struct { User string `json:"user"` Password string `json:"password"` Host string `json:"host"` Database string `json:"database"` } `json:"db"` Server struct { Port int `json:"port"` } `json:"server"` Security struct { Jwt struct { Secret string `json:"secret"` } `json:"jwt"` TwoFA struct { Secret string `json:"secret"` } `json:"2fa"` } `json:"security"` }
Config represents the structure of the config.json file.
type DB ¶
DB is the top-level Database instance.
func (*DB) CheckTemp2FAToken ¶
CheckTemp2FAToken checks the temp 2FA token and its expiration timestamp
func (*DB) DefaultSettings ¶
func (*DB) GetBookmarksByUserID ¶
func (*DB) GetFolders ¶
func (*DB) Init ¶
Init sets up the Database connection. This function will panic if the connection isn't possible.
func (*DB) LoadSettings ¶
func (*DB) SaveBookmark ¶
func (*DB) SaveBookmarkToFolder ¶
func (*DB) SaveFolder ¶
func (*DB) SetTemp2FAToken ¶
SetTempTwoFAToken sets a temp 2FA token and its expiration timestamp
func (*DB) ValidateCredentials ¶
func (*DB) ValidateNewCredentials ¶
type Entity ¶
type Entity struct { gorm.Model `json:"-"` OwnerID uint `json:"-"` Type string `json:"type"` Hash string `json:"hash"` Name string `json:"name"` Pinned bool `json:"pinned"` ImageURL string `json:"image_url"` Bookmark *Bookmark `json:"bookmark"` Folder *Folder `json:"folder"` Note *Note `json:"note"` HasParent bool `json:"has_parent"` }
type EntityRelation ¶
type User ¶
type User struct { gorm.Model Username string `json:"username"` Password string `json:"password"` Role Role `json:"role"` Firstname string `json:"firstname"` Lastname string `json:"lastname"` EMail string `json:"email"` TwoFA bool `json:"-"` TwoFAKey string `json:"-"` TempTwoFAToken string `json:"-"` TempTwoFATokenDate *time.Time `json:"-"` }
Click to show internal directories.
Click to hide internal directories.