Help us shape the future of Go! Take the 2026 Go Developer Survey

models

package
v0.9.82 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 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 Permission

type Permission struct {
	ID        int
	Resource  string
	Action    string
	CreatedAt time.Time
}

func (Permission) TableName

func (Permission) TableName() string

type Role

type Role struct {
	ID          int
	Name        string
	Description string
	IsSystem    bool
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   gorm.DeletedAt

	Permissions []Permission `gorm:"-"`
}

func (Role) TableName

func (Role) TableName() string

type Session added in v0.9.79

type Session struct {
	ID                uuid.UUID `gorm:"primaryKey"`
	UserID            int
	CredentialVersion int64
	RefreshTokenID    uuid.UUID
	ExpiresAt         time.Time
	RevokedAt         sql.Null[time.Time]
	CreatedAt         time.Time
	UpdatedAt         time.Time
}

Session is one login and its rotating refresh-token family. JWT strings are never persisted; the signed session and token IDs identify its state.

func (*Session) TableName added in v0.9.79

func (*Session) TableName() string

type Token

type Token struct {
	ID         int
	UUID       uuid.UUID
	UserID     int
	Token      string
	Name       string
	LastUsedAt sql.Null[time.Time]
	ExpiresAt  sql.Null[time.Time]
	CreatedAt  time.Time
	UpdatedAt  time.Time
	DeletedAt  gorm.DeletedAt

	Permissions []Permission `gorm:"-"`
}

func (*Token) PermissionList

func (a *Token) PermissionList() []string

func (*Token) TableName

func (*Token) TableName() string

type User

type User struct {
	ID                int
	UUID              uuid.UUID
	Email             string
	Password          sql.Null[string]
	CredentialVersion int64 `gorm:"default:1"`
	Status            string
	IsSystem          bool
	Metadata          json.RawMessage
	CreatedAt         time.Time
	UpdatedAt         time.Time
	DeletedAt         gorm.DeletedAt

	Roles []Role `gorm:"-"`
}

func (*User) IsActive

func (u *User) IsActive() bool

func (*User) PermissionList

func (u *User) PermissionList() []string

func (*User) RoleList

func (u *User) RoleList() []string

func (*User) SetPassword

func (u *User) SetPassword(password string) (err error)

func (*User) TableName

func (*User) TableName() string

type UserHistoryRecord

type UserHistoryRecord struct {
	ID         uuid.UUID
	OccurredAt time.Time
	CreatedAt  time.Time
	UserID     int
	EventType  string
	Data       []byte
	Metadata   string
}

func (UserHistoryRecord) TableName

func (UserHistoryRecord) TableName() string

type UserRole

type UserRole struct {
	UserID    int
	RoleID    int
	CreatedAt time.Time
	ExpiresAt sql.Null[time.Time]
}

func (UserRole) TableName

func (UserRole) TableName() string

Jump to

Keyboard shortcuts

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