user_models

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountQueryFromRequest

func CountQueryFromRequest(opts *QueryAndCountFromRequestCfg) error

func FindPasswordByUserID

func FindPasswordByUserID(userID string, passwordRecord *PasswordModel) error

func FindPasswordByUsername

func FindPasswordByUsername(username string, r *PasswordModel) error

func LoadAllUsers

func LoadAllUsers(userList *[]UserModel) error

func QueryAndCountFromRequest

func QueryAndCountFromRequest(opts *QueryAndCountFromRequestCfg) error

func UpdateUserPasswordByUserID

func UpdateUserPasswordByUserID(userID string, password string) error

func UserFindOne

func UserFindOne(id string, record *UserModel) error

FindOne - Find one user record

func UserFindOneByUsername

func UserFindOneByUsername(username string, record *UserModel) error

func UsersQuery

func UsersQuery(userList *[]UserModel, limit int) error

func ValidUsernamePassword

func ValidUsernamePassword(username, password string) (bool, error)

Types

type AuthTokenModel

type AuthTokenModel struct {
	ID              uint64  `gorm:"primary_key;column:id;" json:"id" filter:"param:id;type:number"`
	UserID          *string `gorm:"index:userId;column:userId;type:int(11)" json:"userId" filter:"param:userId;type:number"`
	ProviderUserID  int64   `gorm:"column:providerUserId;type:BIGINT" json:"providerUserId" filter:"param:providerUserId;type:string"`
	TokenProviderID string  `gorm:"column:tokenProviderId;type:VARCHAR(255)" json:"tokenProviderId" filter:"param:tokenProviderId;type:string"`

	TokenType   string `gorm:"column:tokenType;type:VARCHAR(255)" json:"tokenType" filter:"param:tokenType;type:string"`
	Token       string `gorm:"column:token;type:VARCHAR(255)" json:"token" filter:"param:token;type:string"`
	IsValid     bool   `gorm:"column:isValid" json:"isValid" filter:"param:isValid;type:bool"`
	RedirectURL string `gorm:"column:redirectUrl;type:TEXT" json:"redirectUrl" filter:"param:redirectUrl;type:string"`

	CreatedAt time.Time `gorm:"column:createdAt;" json:"createdAt" filter:"param:createdAt"`
	UpdatedAt time.Time `gorm:"column:updatedAt;" json:"updatedAt" filter:"param:updatedAt"`
}

func CreateAuthToken

func CreateAuthToken(userID, tokenType string) (*AuthTokenModel, error)

func FindInvalidOldUserTokens

func FindInvalidOldUserTokens(uid string) ([]*AuthTokenModel, error)

func FindOneAuthToken

func FindOneAuthToken(id string) (*AuthTokenModel, error)

func ValidAuthToken

func ValidAuthToken(userID string, token string) (bool, *AuthTokenModel, error)

func (*AuthTokenModel) Delete

func (r *AuthTokenModel) Delete() error

func (*AuthTokenModel) GetResetUrl

func (r *AuthTokenModel) GetResetUrl(ctx *bolo.RequestContext, resetPrefixName string, resetPrefixNames map[string]string) string

func (*AuthTokenModel) Save

func (r *AuthTokenModel) Save() error

func (*AuthTokenModel) TableName

func (r *AuthTokenModel) TableName() string

type PasswordModel

type PasswordModel struct {
	ID        uint64    `gorm:"primary_key;column:id;" json:"id"`
	UserID    *int64    `gorm:"column:userId;type:bigint(20)" json:"userId"`
	Password  string    `gorm:"column:password;type:text" json:"password"`
	CreatedAt time.Time `gorm:"column:createdAt;type:datetime;not null" json:"createdAt"`
	UpdatedAt time.Time `gorm:"column:updatedAt;type:datetime;not null" json:"updatedAt"`
}

func (*PasswordModel) Compare

func (r *PasswordModel) Compare(password string) (bool, error)

func (*PasswordModel) Generate

func (r *PasswordModel) Generate(password string) ([]byte, error)

func (*PasswordModel) Save

func (r *PasswordModel) Save() error

func (*PasswordModel) SetPassword

func (r *PasswordModel) SetPassword(password string) error

Generate hash from password and set if in .Password attr @param password string raw password to be hashed

func (*PasswordModel) TableName

func (r *PasswordModel) TableName() string

type QueryAndCountFromRequestCfg

type QueryAndCountFromRequestCfg struct {
	Records *[]*UserModel
	Count   *int64
	Limit   int
	Offset  int
	C       echo.Context
	IsHTML  bool
}

type UserModel

type UserModel struct {
	ID uint64 `gorm:"primary_key;column:id;" json:"id" filter:"param:id;type:number"`

	Username string `gorm:"unique;column:username;" json:"username" filter:"param:username;type:string"`
	Email    string `gorm:"unique;column:email;" json:"email" filter:"param:email;type:string"`

	DisplayName string `gorm:"column:displayName;" json:"displayName" filter:"param:displayName;type:string"`
	FullName    string `gorm:"column:fullName;" json:"fullName" filter:"param:fullName;type:string"`
	Biography   string `gorm:"column:biography;type:TEXT;" json:"biography" filter:"param:biography;type:string"`
	Gender      string `gorm:"column:gender;" json:"gender" filter:"param:gender;type:string"`

	Active  bool `gorm:"column:active;" json:"active"`
	Blocked bool `gorm:"column:blocked;" json:"blocked" filter:"param:blocked;type:bool"`

	Language     string `gorm:"column:language;" json:"language" filter:"param:language;type:string"`
	ConfirmEmail string `gorm:"column:confirmEmail;" json:"confirmEmail"`

	AcceptTerms bool   `gorm:"column:acceptTerms;" json:"acceptTerms"`
	Birthdate   string `gorm:"column:birthdate;" json:"birthdate" filter:"param:birthdate;type:date"`
	Phone       string `gorm:"column:phone;" json:"phone" filter:"param:phone;type:string"`

	Roles     []string `gorm:"-" json:"roles"`
	RolesText string   `gorm:"column:roles;" json:"-"`

	CreatedAt time.Time `gorm:"column:createdAt;autoCreateTime:false;" json:"createdAt" filter:"param:createdAt;type:date"`
	UpdatedAt time.Time `gorm:"column:updatedAt;autoupdatetime:false;default:null;" json:"updatedAt" filter:"param:updatedAt;type:date"`
}

func (*UserModel) AddRole

func (r *UserModel) AddRole(role string) error

func (*UserModel) Delete

func (r *UserModel) Delete() error

func (*UserModel) FillById

func (r *UserModel) FillById(id string) error

func (*UserModel) GetAcceptTermsString

func (r *UserModel) GetAcceptTermsString() string

func (*UserModel) GetActiveString

func (r *UserModel) GetActiveString() string

func (*UserModel) GetBiography

func (r *UserModel) GetBiography() string

func (*UserModel) GetBirthdate

func (r *UserModel) GetBirthdate() string

func (*UserModel) GetBlockedString

func (r *UserModel) GetBlockedString() string

func (*UserModel) GetCreatedAtString

func (r *UserModel) GetCreatedAtString() string

func (*UserModel) GetDisplayName

func (r *UserModel) GetDisplayName() string

func (*UserModel) GetEmail

func (r *UserModel) GetEmail() string

func (*UserModel) GetFullName

func (r *UserModel) GetFullName() string

func (*UserModel) GetGender

func (r *UserModel) GetGender() string

func (*UserModel) GetID

func (r *UserModel) GetID() string

func (*UserModel) GetLanguage

func (r *UserModel) GetLanguage() string

func (*UserModel) GetPhone

func (r *UserModel) GetPhone() string

func (*UserModel) GetRoles

func (r *UserModel) GetRoles() []string

func (*UserModel) GetUpdateAtString

func (r *UserModel) GetUpdateAtString() string

func (*UserModel) GetUsername

func (r *UserModel) GetUsername() string

func (*UserModel) IsActive

func (r *UserModel) IsActive() bool

func (*UserModel) IsBlocked

func (r *UserModel) IsBlocked() bool

func (*UserModel) LoadData

func (m *UserModel) LoadData() error

func (*UserModel) LoadTeaserData

func (m *UserModel) LoadTeaserData() error

func (*UserModel) RemoveRole

func (r *UserModel) RemoveRole(role string) error

func (*UserModel) Save

func (m *UserModel) Save(ctx *bolo.RequestContext) error

func (*UserModel) SetActive

func (r *UserModel) SetActive(v bool) error

func (*UserModel) SetBlocked

func (r *UserModel) SetBlocked(blocked bool) error

func (*UserModel) SetDisplayName

func (r *UserModel) SetDisplayName(v string) error

func (*UserModel) SetEmail

func (r *UserModel) SetEmail(v string) error

func (*UserModel) SetFullName

func (r *UserModel) SetFullName(v string) error

func (*UserModel) SetID

func (r *UserModel) SetID(id string) error

func (*UserModel) SetLanguage

func (r *UserModel) SetLanguage(v string) error

func (*UserModel) SetPassword

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

func (*UserModel) SetRole

func (r *UserModel) SetRole(roleName string) []string

func (*UserModel) SetRoles

func (r *UserModel) SetRoles(v []string) error

func (*UserModel) SetUsername

func (r *UserModel) SetUsername(v string) error

func (UserModel) TableName

func (UserModel) TableName() string

func (*UserModel) ValidPassword

func (m *UserModel) ValidPassword(password string) (bool, error)

type UserModelPublic

type UserModelPublic struct {
	ID uint64 `gorm:"primary_key;column:id;" json:"id" filter:"param:id;type:number"`

	Username string `gorm:"unique;column:username;" json:"username" filter:"param:username;type:string"`

	DisplayName string `gorm:"column:displayName;" json:"displayName" filter:"param:displayName;type:string"`

	Language string `gorm:"column:language;" json:"language" filter:"param:language;type:string"`

	CreatedAt time.Time `gorm:"column:createdAt;" json:"createdAt" filter:"param:createdAt;type:date"`
	UpdatedAt time.Time `gorm:"column:updatedAt;" json:"updatedAt" filter:"param:updatedAt;type:date"`
}

func NewUserModelPublicFromUserModel

func NewUserModelPublicFromUserModel(userRecord *UserModel) *UserModelPublic

func (*UserModelPublic) GetID

func (r *UserModelPublic) GetID() string

func (*UserModelPublic) TableName

func (m *UserModelPublic) TableName() string

TableName get sql table name

Jump to

Keyboard shortcuts

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