Documentation
¶
Overview ¶
Package user present full API functionality of the specific object
Index ¶
- type AuthCapableModel
- type Base
- type Email
- type EmailCapableModel
- type EmailModel
- type EmailRepository
- type EmailUsecase
- type FilterBase
- type FilterEmail
- type ListFilter
- type ListOptions
- type ListOrder
- type Model
- type Order
- type OrderBase
- type OrderEmail
- type OrderUsername
- type Pagination
- type Password
- type PasswordCapableModel
- type PasswordModel
- type PasswordRepository
- type PasswordUsecase
- type QOption
- type Repository
- type Usecase
- type UserPasswordReset
- type Username
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthCapableModel ¶ added in v0.5.0
type AuthCapableModel interface {
Model
EmailModel
PasswordModel
}
AuthCapableModel combines core user with email and password traits. Use only as constraint for PasswordResetQueryResolver (email → userID → password usecase).
type EmailCapableModel ¶ added in v0.5.0
type EmailCapableModel interface {
Model
EmailModel
}
EmailCapableModel combines core Model with email trait for email repository/usecase.
type EmailModel ¶ added in v0.5.0
EmailModel is the email identity trait (orthogonal to Model).
type EmailRepository ¶ added in v0.5.0
type EmailRepository[T EmailCapableModel] interface { GetByEmail(ctx context.Context, email string) (T, error) }
EmailRepository provides email lookup for models with UserEmail trait.
type EmailUsecase ¶ added in v0.5.0
type EmailUsecase[T EmailCapableModel] interface { GetByEmail(ctx context.Context, email string) (T, error) }
EmailUsecase provides email lookup operations.
type FilterBase ¶ added in v0.5.0
type FilterBase struct {
ID []uint64
}
FilterBase contains the core ID filter (Model trait only). Embed into your custom filter struct; call Apply in PrepareQuery.
type FilterEmail ¶ added in v0.5.0
type FilterEmail struct {
Emails []string
}
FilterEmail contains the email filter (Email trait only). Embed into your custom filter struct; call Apply in PrepareQuery.
type ListFilter ¶
type ListFilter struct {
FilterBase
FilterEmail
}
ListFilter is the backward-compatible composite filter (FilterBase + FilterEmail). Consumer projects should compose FilterBase + FilterEmail (+ custom fields) directly.
func (*ListFilter) PrepareQuery ¶
func (fl *ListFilter) PrepareQuery(q *gorm.DB) *gorm.DB
PrepareQuery applies all embedded filter parts.
type ListOptions ¶ added in v0.4.0
type ListOptions = repository.ListOptions
ListOptions is the list options struct
type ListOrder ¶
type ListOrder struct {
OrderBase
OrderEmail
}
ListOrder is the backward-compatible composite order (OrderBase + OrderEmail). Consumer projects should compose OrderBase + OrderEmail (+ custom fields) directly.
type Model ¶ added in v0.5.0
type Model interface {
auth.IsNillable
GetID() uint64
IsAnonymous() bool
NewWithID(id uint64) Model
CreatorUserID() uint64
}
Model is the compile-time constraint for core user repository/usecase operations.
type OrderBase ¶ added in v0.5.0
OrderBase contains core order fields (Model trait only). Embed into your custom order struct; call Apply in PrepareQuery.
type OrderEmail ¶ added in v0.5.0
type OrderEmail struct {
Email Order
}
OrderEmail contains the email order field (Email trait only).
type OrderUsername ¶ added in v0.5.0
type OrderUsername struct {
Username Order
}
OrderUsername contains the username order field (Username trait only).
type Pagination ¶ added in v0.4.0
type Pagination = repository.Pagination
Pagination is the pagination object
type Password ¶ added in v0.5.0
type Password = models.UserPassword
Password is the optional password authentication trait.
type PasswordCapableModel ¶ added in v0.5.0
type PasswordCapableModel interface {
Model
PasswordModel
}
PasswordCapableModel combines core Model with password trait for password repository/usecase.
type PasswordModel ¶ added in v0.5.0
type PasswordModel interface {
GetPasswordHash() string
SetPasswordHash(string)
RequiredPasswordReset() bool
}
PasswordModel is the password authentication trait (orthogonal to Model and EmailModel).
type PasswordRepository ¶ added in v0.5.0
type PasswordRepository[T PasswordCapableModel] interface { GetByPassword(ctx context.Context, userID uint64, password string) (T, error) CreateWithPassword(ctx context.Context, user T, password string) (uint64, error) SetPassword(ctx context.Context, user T, password string) error CreateResetPassword(ctx context.Context, userID uint64) (*UserPasswordReset, error) GetResetPassword(ctx context.Context, userID uint64, token string) (*UserPasswordReset, error) EliminateResetPassword(ctx context.Context, userID uint64) error }
PasswordRepository provides password auth and reset token operations.
type PasswordUsecase ¶ added in v0.5.0
type PasswordUsecase[T PasswordCapableModel] interface { Repo() PasswordRepository[T] SetPassword(ctx context.Context, user T, password string) error ChangePassword(ctx context.Context, currentPassword, newPassword string) error ResetPassword(ctx context.Context, userID uint64) (*UserPasswordReset, T, error) UpdatePassword(ctx context.Context, userID uint64, token, password string) error }
PasswordUsecase provides password management operations (no email lookup).
type QOption ¶ added in v0.4.0
type QOption = repository.QOption
QOption is the query option interface
type Repository ¶
type Repository[T Model] interface { EmptyObject() T Get(ctx context.Context, id uint64) (T, error) FetchList(ctx context.Context, opts ...QOption) ([]T, error) Count(ctx context.Context, opts ...QOption) (int64, error) Create(ctx context.Context, user T) (uint64, error) Update(ctx context.Context, user T) error Delete(ctx context.Context, id uint64) error }
Repository is the core CRUD repository parameterized by user model type. T must be a pointer type implementing Model (e.g. *MyUser).
type Usecase ¶
type Usecase[T Model] interface { EmptyObject() T Get(ctx context.Context, id uint64) (T, error) FetchList(ctx context.Context, opts ...QOption) ([]T, error) Count(ctx context.Context, opts ...QOption) (int64, error) Create(ctx context.Context, user T) (uint64, error) Update(ctx context.Context, user T) error Delete(ctx context.Context, id uint64) error }
Usecase is core user business logic parameterized by model type. T must be a pointer type (e.g. *MyUser).
type UserPasswordReset ¶ added in v0.4.0
type UserPasswordReset = models.UserPasswordReset
UserPasswordReset is the model for password reset tokens.
type Username ¶ added in v0.5.0
type Username = models.UserUsername
Username is the optional separate username trait.
Directories
¶
| Path | Synopsis |
|---|---|
|
delivery
|
|
|
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
|
Package usecase user managing
|
Package usecase user managing |