models

package
v0.0.0-...-95ef5b1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlacklistedTokens

type BlacklistedTokens struct {
	gorm.Model
	Token string `gorm:"uniqueIndex" json:"token"`
}

func (*BlacklistedTokens) BlacklistToken

func (t *BlacklistedTokens) BlacklistToken() bool

func (*BlacklistedTokens) IsTokenBlacklisted

func (t *BlacklistedTokens) IsTokenBlacklisted() bool

type UserCheckParams

type UserCheckParams struct {
	UserId   uint
	Username string
	Email    string
}

type Users

type Users struct {
	gorm.Model
	Username    string `gorm:"unique;not null" json:"username"`
	Email       string `gorm:"unique;not null" json:"email"`
	Password    string `gorm:"not null" json:"password"`
	IsSuperuser bool   `gorm:"default=false;not null" json:"is_superuser"`
	IsActive    bool   `gorm:"default=true;not null" json:"is_active"`
}

func GetUserById

func GetUserById(userId uint) (*Users, error)

func GetUsersList

func GetUsersList(limit, offset int) ([]Users, int64, error)

func ValidateUserExistsWithEmailOrUsername

func ValidateUserExistsWithEmailOrUsername(params UserCheckParams) (*Users, string, bool)

func (*Users) DeleteUser

func (u *Users) DeleteUser() error

func (*Users) GeneratePasswordHash

func (u *Users) GeneratePasswordHash() (error, bool)

func (*Users) Save

func (u *Users) Save() error

func (*Users) UpdateUser

func (userToUpdate *Users) UpdateUser(updateData interface{}, omitFields ...string) (*Users, error)

func (*Users) ValidatePasswordHash

func (user *Users) ValidatePasswordHash(password string) (string, bool)

func (*Users) ValidateUserExists

func (u *Users) ValidateUserExists() (string, bool)

Jump to

Keyboard shortcuts

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