lib

package
v0.0.0-...-e53affe Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB
View Source
var (
	Rdb *redis.Client
)

Functions

func CreateTokens

func CreateTokens(roles string, email string) (string, string, error)

func DeleteValue

func DeleteValue(key string) error

func GetTTL

func GetTTL(key string) (int64, error)

func GetValue

func GetValue(key string) (string, error)

func InitRedis

func InitRedis()

func InitializeDatabase

func InitializeDatabase()

func JWTAuthMiddleware

func JWTAuthMiddleware() gin.HandlerFunc

func SetValue

func SetValue(key string, value string, expiration time.Duration) error

Types

type Claims

type Claims struct {
	Email string `json:"email"`
	Roles string `json:"roles,omitempty"`
	jwt.RegisteredClaims
}

type Form

type Form struct {
	ID           uuid.UUID `gorm:"type:uuid;primaryKey;" json:"id"`
	FormConfigID uuid.UUID `gorm:"type:uuid;not null;index;" json:"form_id"`
	Data         string    `gorm:"type:text;not null" json:"data"`
	CreatedAt    time.Time `gorm:"autoCreateTime" json:"-"`
}

type FormConfig

type FormConfig struct {
	ID             uuid.UUID      `gorm:"type:uuid;primaryKey;" json:"id"`
	UserEmail      string         `gorm:"type:varchar(100);not null;index;" json:"user_email"`
	AllowedDomains string         `gorm:"type:text;not null" json:"allowed_domains"`
	CreatedAt      time.Time      `gorm:"autoCreateTime" json:"-"`
	UpdatedAt      time.Time      `gorm:"autoUpdateTime" json:"-"`
	DeletedAt      gorm.DeletedAt `gorm:"index" json:"-"`
}

func (*FormConfig) BeforeCreate

func (f *FormConfig) BeforeCreate(tx *gorm.DB) (err error)

type User

type User struct {
	ID             uuid.UUID      `gorm:"type:text;primaryKey;" json:"id"`
	Name           string         `gorm:"type:varchar(100);not null" json:"name"`
	Email          string         `gorm:"type:varchar(100);unique;not null" json:"email"`
	Password       string         `gorm:"type:text;not null" json:"-"`
	Roles          string         `gorm:"type:text;not null;default:''" json:"-"`
	Status         string         `gorm:"type:text;not null;default:'active'" json:"-"`
	ProfilePicture *string        `gorm:"type:text" json:"profile_picture,omitempty"`
	LastLoginAt    *time.Time     `gorm:"type:timestamp" json:"-"`
	CreatedAt      time.Time      `gorm:"autoCreateTime" json:"-"`
	UpdatedAt      time.Time      `gorm:"autoUpdateTime" json:"-"`
	DeletedAt      gorm.DeletedAt `gorm:"index" json:"-"`
}

func (*User) BeforeCreate

func (u *User) BeforeCreate(tx *gorm.DB) (err error)

Jump to

Keyboard shortcuts

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