models

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UserBase added in v0.5.0

type UserBase struct {
	ID        uint64                  `json:"id" gorm:"primaryKey"`
	Approve   pkgModels.ApproveStatus `gorm:"column:approve_status" db:"approve_status" json:"approve_status"`
	CreatedAt time.Time               `json:"created_at"`
	UpdatedAt time.Time               `json:"updated_at"`
	DeletedAt gorm.DeletedAt          `json:"deleted_at"`
}

UserBase is the minimal embeddable user identity (Member anchor).

func (*UserBase) CreatorUserID added in v0.5.0

func (u *UserBase) CreatorUserID() uint64

CreatorUserID returns the user id for ACL ownership checks.

func (*UserBase) GetApprove added in v0.5.0

func (u *UserBase) GetApprove() pkgModels.ApproveStatus

GetApprove returns approval status.

func (*UserBase) GetCreatedAt added in v0.5.0

func (u *UserBase) GetCreatedAt() time.Time

GetCreatedAt returns created timestamp.

func (*UserBase) GetID added in v0.5.0

func (u *UserBase) GetID() uint64

GetID returns user ID.

func (*UserBase) GetUpdatedAt added in v0.5.0

func (u *UserBase) GetUpdatedAt() time.Time

GetUpdatedAt returns updated timestamp.

func (*UserBase) IsAnonymous added in v0.5.0

func (u *UserBase) IsAnonymous() bool

IsAnonymous reports whether this is an anonymous user.

func (*UserBase) IsNil added in v0.5.0

func (u *UserBase) IsNil() bool

IsNil checks if the user is nil.

func (*UserBase) RBACResourceName added in v0.5.0

func (u *UserBase) RBACResourceName() string

RBACResourceName returns the default RBAC resource name (override on consumer type).

func (*UserBase) SetApprove added in v0.5.0

func (u *UserBase) SetApprove(status pkgModels.ApproveStatus)

SetApprove sets approval status.

func (*UserBase) SetCreatedAt added in v0.5.0

func (u *UserBase) SetCreatedAt(t time.Time)

SetCreatedAt sets created timestamp.

func (*UserBase) SetID added in v0.5.0

func (u *UserBase) SetID(id uint64)

SetID sets user primary key.

func (*UserBase) SetUpdatedAt added in v0.5.0

func (u *UserBase) SetUpdatedAt(t time.Time)

SetUpdatedAt sets updated timestamp.

func (*UserBase) TableName added in v0.5.0

func (u *UserBase) TableName() string

TableName returns the default database table (override on consumer type).

type UserEmail added in v0.5.0

type UserEmail struct {
	Email string `json:"email" gorm:"column:email;not null;default:'';"`
}

UserEmail optional trait: email identity.

func (*UserEmail) EmailColumn added in v0.5.0

func (u *UserEmail) EmailColumn() string

EmailColumn returns the database column name.

func (*UserEmail) GetEmail added in v0.5.0

func (u *UserEmail) GetEmail() string

GetEmail returns the user email.

func (*UserEmail) SetEmail added in v0.5.0

func (u *UserEmail) SetEmail(email string)

SetEmail sets the user email.

type UserPassword added in v0.5.0

type UserPassword struct {
	Password          string `json:"password" gorm:"column:password;not null;default:'';"`
	MustResetPassword bool   `json:"required_password_reset" gorm:"column:required_password_reset;not null;default:false"`
}

UserPassword optional trait: password authentication.

func (*UserPassword) GetPasswordHash added in v0.5.0

func (u *UserPassword) GetPasswordHash() string

GetPasswordHash returns the stored password hash.

func (*UserPassword) PasswordColumn added in v0.5.0

func (u *UserPassword) PasswordColumn() string

PasswordColumn returns the database column name.

func (*UserPassword) RequiredPasswordReset added in v0.5.0

func (u *UserPassword) RequiredPasswordReset() bool

RequiredPasswordReset reports whether the user must reset password on next login.

func (*UserPassword) SetPasswordHash added in v0.5.0

func (u *UserPassword) SetPasswordHash(hash string)

SetPasswordHash sets the stored password hash.

type UserPasswordReset

type UserPasswordReset struct {
	UserID uint64 `json:"user_id" gorm:"primaryKey"`
	Token  string `json:"token" gorm:"index:,unique" limit:"128"`

	CreatedAt time.Time `json:"created_at"`
	ExpiresAt time.Time `json:"expires_at"`
}

UserPasswordReset direct defenition

func (*UserPasswordReset) TableName

func (u *UserPasswordReset) TableName() string

TableName returns the name in database

type UserUsername added in v0.5.0

type UserUsername struct {
	Username string `json:"username" gorm:"column:username"`
}

UserUsername optional trait: separate username (GraphQL compatibility).

func (*UserUsername) GetUsername added in v0.5.0

func (u *UserUsername) GetUsername() string

GetUsername returns the username.

Jump to

Keyboard shortcuts

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