Documentation
¶
Index ¶
- type APICredentials
- type GroupPermission
- type Permission
- type PermissionGroup
- type Role
- type RoleAssignment
- type RolePermission
- type SocialAccount
- type User
- func (u *User) GetEmail() string
- func (u *User) GetEmailVerified() bool
- func (u *User) GetEmailVerifiedAt() *types.DateTime
- func (u *User) GetID() uuid.UUID
- func (u *User) GetLastLoginAt() *time.Time
- func (u *User) GetMetadata() map[string]any
- func (u *User) GetPasswordHash() string
- func (u *User) GetPasswordResetAt() *time.Time
- func (u *User) GetPasswordResetToken() *string
- func (u *User) GetPhoneNumber() string
- func (u *User) GetRole() string
- func (u *User) GetUsername() string
- func (u *User) IsActive() bool
- func (u *User) SetPassword(password string)
- func (u *User) SetPasswordResetAt(at *time.Time)
- func (u *User) SetPasswordResetToken(token *string)
- type UserGroup
- type UserPermission
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) GetEmailVerified ¶
func (*User) GetEmailVerifiedAt ¶
func (*User) GetLastLoginAt ¶
func (*User) GetMetadata ¶
func (*User) GetPasswordHash ¶
func (*User) GetPasswordResetAt ¶
func (*User) GetPasswordResetToken ¶
func (*User) GetPhoneNumber ¶
func (*User) GetUsername ¶
func (*User) SetPassword ¶
func (*User) SetPasswordResetAt ¶
func (*User) SetPasswordResetToken ¶
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