models

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APICredentials

type APICredentials struct {
	APIKey    string    `json:"api_key"`
	APISecret string    `json:"api_secret"`
	IssuedAt  time.Time `json:"issued_at"`
	ExpiresAt time.Time `json:"expires_at"`

} // @name APICredentials

APICredentials represents API key credentials

type GroupPermission

type GroupPermission struct {
	ID           uuid.UUID `gorm:"primaryKey"`
	GroupID      uuid.UUID `gorm:"index:idx_group_permissions_group_perm"`
	PermissionID uuid.UUID `gorm:"index:idx_group_permissions_group_perm"`
	CreatedAt    time.Time
	ExpiresAt    *time.Time

} // @name GroupPermission

GroupPermission represents a permission assignment to a group

type Permission

type Permission struct {
	ID          string `gorm:"primaryKey"`
	Name        string `gorm:"index"`
	Resource    string `gorm:"index"`
	Action      string `gorm:"index"`
	Description string
	Metadata    map[string]any `gorm:"type:jsonb"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   gorm.DeletedAt `gorm:"index"`

} // @name Permission

Permission represents a permission in the system

type PermissionGroup

type PermissionGroup struct {
	ID          uuid.UUID `gorm:"primaryKey"`
	Name        string    `gorm:"uniqueIndex:idx_permission_groups_name"`
	Description string
	Metadata    map[string]interface{} `gorm:"type:jsonb"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   gorm.DeletedAt `gorm:"index"`

} // @name PermissionGroup

PermissionGroup represents a group of permissions

type Role

type Role struct {
	ID          uuid.UUID `gorm:"primaryKey"`
	Name        string    `gorm:"uniqueIndex:idx_roles_name_tenant"`
	Description string
	Metadata    map[string]interface{} `gorm:"type:jsonb"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   gorm.DeletedAt `gorm:"index"`

} // @name Role

Role represents a role in the system

type RoleAssignment

type RoleAssignment struct {
	ID        uuid.UUID `gorm:"primaryKey"`
	UserID    uuid.UUID `gorm:"index:idx_role_assignments_user_role"`
	RoleID    uuid.UUID `gorm:"index:idx_role_assignments_user_role"`
	CreatedAt time.Time
	ExpiresAt *time.Time

} // @name RoleAssignment

RoleAssignment represents a role assignment to a user

type RolePermission

type RolePermission struct {
	ID           uuid.UUID `gorm:"primaryKey"`
	RoleID       uuid.UUID `gorm:"index:idx_role_permissions_role_perm"`
	PermissionID uuid.UUID `gorm:"index:idx_role_permissions_role_perm"`
	CreatedAt    time.Time
	ExpiresAt    *time.Time

} // @name RolePermission

RolePermission represents a permission assignment to a role

type SocialAccount

type SocialAccount struct {
	model.Model
	UserID         uuid.UUID          `gorm:"not null;index"`
	User           User               `gorm:"foreignKey:UserID;references:ID"`
	Provider       types.AuthProvider `gorm:"not null;index"`
	ProviderUserID string             `gorm:"not null;uniqueIndex:idx_social_accounts_provider_id"`
	Email          string             `gorm:"unqiueIndex:idx_social_accounts_provider_email"`
	Name           string             `gorm:"size:255"`
	Metadata       json.RawMessage    `gorm:"type:jsonb" json:"-"`

} // @name SocialAccount

SocialAccount represents a social media account linked to a user

func (*SocialAccount) TableName

func (sa *SocialAccount) TableName() string

TableName returns the table name for the social account model

type User

type User struct {
	ID                 uuid.UUID       `gorm:"primaryKey" json:"id"`
	Email              string          `gorm:"uniqueIndex" json:"email"`
	PhoneNumber        string          `gorm:"uniqueIndex" json:"phoneNumber"`
	Username           string          `gorm:"uniqueIndex" json:"username"`
	Password           string          `json:"-"`
	Metadata           json.RawMessage `gorm:"type:jsonb" json:"-"`
	Active             bool            `gorm:"default:true" json:"active"`
	PasswordResetToken *string         `json:"-"`
	Token              *string         `json:"-"`
	CreatedAt          time.Time       `json:"createdAt"`
	UpdatedAt          time.Time       `json:"updatedAt"`
	LastLoginAt        *time.Time      `json:"-"`
	PasswordResetAt    *time.Time      `json:"-"`
	DeletedAt          gorm.DeletedAt  `gorm:"index" json:"-"`
	Role               string          `json:"role"`
	EmailVerified      bool            `json:"emailVerified"`
	EmailVerifiedAt    *types.DateTime `json:"-"`

} // @name User

User represents a user in the system

func (*User) GetEmail

func (u *User) GetEmail() string

func (*User) GetEmailVerified

func (u *User) GetEmailVerified() bool

func (*User) GetEmailVerifiedAt

func (u *User) GetEmailVerifiedAt() *types.DateTime

func (*User) GetID

func (u *User) GetID() uuid.UUID

func (*User) GetLastLoginAt

func (u *User) GetLastLoginAt() *time.Time

func (*User) GetMetadata

func (u *User) GetMetadata() map[string]any

func (*User) GetPasswordHash

func (u *User) GetPasswordHash() string

func (*User) GetPasswordResetAt

func (u *User) GetPasswordResetAt() *time.Time

func (*User) GetPasswordResetToken

func (u *User) GetPasswordResetToken() *string

func (*User) GetPhoneNumber

func (u *User) GetPhoneNumber() string

func (*User) GetRole

func (u *User) GetRole() string

func (*User) GetUsername

func (u *User) GetUsername() string

func (*User) IsActive

func (u *User) IsActive() bool

func (*User) SetPassword

func (u *User) SetPassword(password string)

func (*User) SetPasswordResetAt

func (u *User) SetPasswordResetAt(at *time.Time)

func (*User) SetPasswordResetToken

func (u *User) SetPasswordResetToken(token *string)

type UserGroup

type UserGroup struct {
	ID        uuid.UUID `gorm:"primaryKey"`
	UserID    uuid.UUID `gorm:"index:idx_user_groups_user"`
	GroupID   uuid.UUID `gorm:"index:idx_user_groups_group"`
	CreatedAt time.Time
	ExpiresAt *time.Time

} // @name UserGroup

UserGroup represents a user's membership in a group

type UserPermission

type UserPermission struct {
	ID           uuid.UUID `gorm:"primaryKey"`
	UserID       uuid.UUID `gorm:"index:idx_user_permissions_user_perm"`
	PermissionID uuid.UUID `gorm:"index:idx_user_permissions_user_perm"`
	CreatedAt    time.Time
	ExpiresAt    *time.Time
	GrantedBy    *uuid.UUID

} // @name UserPermission

UserPermission represents a direct permission assignment to a user

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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