ds

package
v0.0.0-...-364ee8c Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadExistingDatabase

func LoadExistingDatabase(dbPath string) (*gorm.DB, error)

LoadExistingDatabase opens an existing database and runs migrations

func SetupNewDatabase

func SetupNewDatabase(dbPath string) (*gorm.DB, error)

SetupNewDatabase creates a new database and runs migrations

Types

type TokenData

type TokenData struct {
	gorm.Model
	AssociatedUserID uint      // Foreign key for User
	AssociatedUser   User      `gorm:"foreignKey:AssociatedUserID"` // The user who made the token
	Generated        time.Time `gorm:"not null"`                    // when they made the token
	Token            string    `gorm:"uniqueIndex;not null"`        // The token
	Disabled         bool      `gorm:"default:false"`               // when true, it's blacklisted
}

type User

type User struct {
	gorm.Model
	Email              string `gorm:"uniqueIndex;not null"`
	Username           string `gorm:"uniqueIndex;not null"`
	PasswordBcryptHash []byte `gorm:"not null"`
	IsVerified         bool   `gorm:"default:false"`
}

type UserMeta

type UserMeta struct {
	gorm.Model
	UserID   uint `gorm:"uniqueIndex"`       // Foreign key for User
	UserData User `gorm:"foreignKey:UserID"` // foreign ref to User struct
}

Jump to

Keyboard shortcuts

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