database

package
v0.0.0-...-8371504 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfList = []*Config{
	{"registration", "1", true},
	{"secret", uuid.New().String(), false},
}
View Source
var ConfMap = map[string]string{}

Functions

func Connect

func Connect(dsn string) (e error)

Types

type Config

type Config struct {
	Key    string `gorm:"primaryKey"`
	Value  string
	Public bool
}

func (*Config) Sync

func (c *Config) Sync() string

type User

type User struct {
	gorm.Model
	Name   string `gorm:"uniqueIndex"`
	Mail   string `gorm:"uniqueIndex"`
	Auth   []byte `json:"-"`
	Group  uint
	Status string
}

func GetUser

func GetUser(u any) *User

func (*User) Compare

func (u *User) Compare(p string) bool

func (*User) Create

func (u *User) Create() bool

func (*User) GetToken

func (u *User) GetToken() (string, error)

func (*User) SetPass

func (u *User) SetPass(p string) (e error)

type UserJWT

type UserJWT struct {
	UID   uint
	Group uint
	jwt.RegisteredClaims
}

Jump to

Keyboard shortcuts

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