models

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LinkModel

type LinkModel struct {
	ID             uint       `gorm:"column:id;primary_key"`
	Name           *string    `gorm:"column:name"`
	RealUrl        string     `gorm:"column:real_url;unique"`
	GeneratedAlias string     `gorm:"column:generated_alias;unique"`
	CreatedAt      *time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP"`
	UserID         uint       `gorm:"column:user_id"`
}

func (*LinkModel) TableName

func (e *LinkModel) TableName() string

TableName is Database TableName of this model

type UserModel

type UserModel struct {
	ID           uint        `gorm:"column:id;primary_key"`
	Email        string      `gorm:"column:email;unique_index"`
	PasswordHash string      `gorm:"column:password;not null"`
	Role         string      `gorm:"column:role;default:user"`
	RegisteredAt *time.Time  `gorm:"column:registered_at;not null;default:CURRENT_TIMESTAMP"`
	Links        []LinkModel `gorm:"foreignKey:user_id;references:id"`
}

func FindOneUser

func FindOneUser(condition any) (UserModel, *utils.CommonError)

func (*UserModel) ComparePassword

func (u *UserModel) ComparePassword(password string) error

func (*UserModel) SetPassword

func (u *UserModel) SetPassword(password string) error

func (*UserModel) TableName

func (e *UserModel) TableName() string

Jump to

Keyboard shortcuts

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