database

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountAdmins

func CountAdmins(db *gorm.DB) int64

func GetDatabaseConnection

func GetDatabaseConnection(cfg *config.Config) (*gorm.DB, error)

Types

type Admin

type Admin struct {
	ID       uint64 `gorm:"primaryKey"`
	Username string `gorm:"unique;notNull"`
	Bcrypt   string `gorm:"notNull"`
}

func AuthorizeAdmin

func AuthorizeAdmin(db *gorm.DB, username string, password string) (Admin, error)

func CreateAdmin

func CreateAdmin(db *gorm.DB, username string, password string) (Admin, error)

type Group

type Group struct {
	ID    uint64 `gorm:"primaryKey"`
	Name  string `gorm:"unique,notNull"`
	Links []Link `gorm:"constraint:OnDelete:CASCADE;"`
}
type Link struct {
	ID      uint64 `gorm:"primaryKey"`
	Name    string `gorm:"notNull"`
	Href    string `gorm:"notNull"`
	GroupID uint64 `gorm:"notNull"`
}

Jump to

Keyboard shortcuts

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