Documentation ¶
Index ¶
- Variables
- type AuthLogin
- type AuthLogout
- type AuthRefresh
- type AuthService
- func (s AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Account(ctx context.Context) (*model.User, error)
- func (s AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Login(ctx context.Context, input AuthLogin) (*model.AuthToken, error)
- func (s AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Logout(ctx context.Context, input AuthLogout) error
- func (s AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Refresh(ctx context.Context, input AuthRefresh) (*model.AuthToken, error)
- func (s AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Trx(db *gorm.DB) IAuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]
- func (s AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) UpdateAccountData(ctx context.Context, input AuthUpdateAccountData, ...) error
- type AuthUpdateAccountData
- type IAuthService
- type IPermissionService
- type IRoleService
- type ISettingService
- type IUserService
- type PermissionService
- type RoleCreateInput
- type RoleService
- func (s RoleService) Create(ctx context.Context, input RoleCreateInput) (*model.Role, error)
- func (s RoleService) Delete(ctx context.Context, id int) error
- func (s RoleService) GetById(ctx context.Context, id int) (*model.Role, error)
- func (s RoleService) List(ctx context.Context, m *model2.Meta[model.Role]) error
- func (s RoleService) Trx(db *gorm.DB) IRoleService
- func (s RoleService) Update(ctx context.Context, id int, input RoleUpdateInput) error
- type RoleUpdateInput
- type SettingService
- type SettingUpdateInput
- type UserCreateInput
- type UserService
- func (s UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Create(ctx context.Context, input UserCreateInput, profileInput *CreateInput) (*model.User, error)
- func (s UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Delete(ctx context.Context, id int) error
- func (s UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) GetById(ctx context.Context, id int) (*model.User, error)
- func (s UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) List(ctx context.Context, m *model2.Meta[model.User]) error
- func (s UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Trx(db *gorm.DB) IUserService[Model, CreateInput, UpdateInput, UpdateProfileInput]
- func (s UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Update(ctx context.Context, id int, input UserUpdateInput, profileInput *UpdateInput) error
- type UserUpdateInput
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRoleNotFound = apperr.New("role_not_found", apperr.WithTextTranslate(i18n.ErrRoleNotFound), apperr.WithCode(code.NotFound)) ErrRoleExists = apperr.New("role_exists_error", apperr.WithTextTranslate(i18n.ErrRoleExists), apperr.WithCode(code.InvalidArgument)) ErrRoleCannotBeChanged = apperr.New("role_cannot_be_changed", apperr.WithTextTranslate(i18n.ErrRoleCannotBeChanged), apperr.WithCode(code.PermissionDenied)) ErrRoleCannotBeDeleted = apperr.New("role_cannot_be_deleted", apperr.WithTextTranslate(i18n.ErrRoleCannotBeDeleted), apperr.WithCode(code.PermissionDenied)) )
View Source
var ( ErrUserNotFound = apperr.New("user_not_found", apperr.WithTextTranslate(i18n.ErrUserNotFound), apperr.WithCode(code.NotFound)) ErrUserExists = apperr.New("user_exists_error", apperr.WithTextTranslate(i18n.ErrUserExists), apperr.WithCode(code.InvalidArgument)) ErrUserRolesCannotBeChanged = apperr.New("user_roles_cannot_be_changed", apperr.WithTextTranslate(i18n.ErrUserRolesCannotBeChanged), apperr.WithCode(code.PermissionDenied)) ErrUserCannotBeDeleted = apperr.New("user_cannot_be_deleted", apperr.WithTextTranslate(i18n.ErrUserCannotBeDeleted), apperr.WithCode(code.PermissionDenied)) )
Functions ¶
This section is empty.
Types ¶
type AuthLogout ¶
type AuthLogout struct {
Token string
}
type AuthRefresh ¶
type AuthService ¶
type AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput any] struct { // contains filtered or unexported fields }
func NewAuthService ¶
func NewAuthService[Model, CreateInput, UpdateInput, UpdateProfileInput any]( profileService profile.IProfileService[Model, CreateInput, UpdateInput, UpdateProfileInput], userRepository repository.IUserRepository, tokenRepository repository.ITokenRepository, tokenCache cache.ITokenCache, userCache cache.IUserCache, hasher secret.Hasher, accessExpire time.Duration, refreshExpire time.Duration, accessSecret string, ) AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]
func (AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Logout ¶
func (s AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Logout(ctx context.Context, input AuthLogout) error
func (AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Refresh ¶
func (s AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Refresh(ctx context.Context, input AuthRefresh) (*model.AuthToken, error)
func (AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Trx ¶
func (s AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Trx(db *gorm.DB) IAuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]
func (AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) UpdateAccountData ¶ added in v2.0.12
func (s AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) UpdateAccountData(ctx context.Context, input AuthUpdateAccountData, profileInput *UpdateProfileInput) error
type AuthUpdateAccountData ¶ added in v2.0.12
type IAuthService ¶
type IAuthService[Model, CreateInput, UpdateInput, UpdateProfileInput any] interface { Trx(db *gorm.DB) IAuthService[Model, CreateInput, UpdateInput, UpdateProfileInput] Login(ctx context.Context, input AuthLogin) (*model.AuthToken, error) Refresh(ctx context.Context, input AuthRefresh) (*model.AuthToken, error) Logout(ctx context.Context, input AuthLogout) error Account(ctx context.Context) (*model.User, error) UpdateAccountData(ctx context.Context, input AuthUpdateAccountData, profileInput *UpdateProfileInput) error }
type IPermissionService ¶ added in v2.0.4
type IPermissionService interface { Trx(db *gorm.DB) IPermissionService List(ctx context.Context) ([]model.Permission, error) }
type IRoleService ¶ added in v2.0.4
type IRoleService interface { Trx(db *gorm.DB) IRoleService List(ctx context.Context, m *model2.Meta[model.Role]) error GetById(ctx context.Context, id int) (*model.Role, error) Create(ctx context.Context, input RoleCreateInput) (*model.Role, error) Update(ctx context.Context, id int, input RoleUpdateInput) error Delete(ctx context.Context, id int) error }
type ISettingService ¶ added in v2.0.18
type IUserService ¶ added in v2.0.4
type IUserService[Model, CreateInput, UpdateInput, UpdateProfileInput any] interface { Trx(db *gorm.DB) IUserService[Model, CreateInput, UpdateInput, UpdateProfileInput] List(ctx context.Context, m *model2.Meta[model.User]) error GetById(ctx context.Context, id int) (*model.User, error) Create(ctx context.Context, input UserCreateInput, profileInput *CreateInput) (*model.User, error) Update(ctx context.Context, id int, input UserUpdateInput, profileInput *UpdateInput) error Delete(ctx context.Context, id int) error }
type PermissionService ¶ added in v2.0.4
type PermissionService struct {
// contains filtered or unexported fields
}
func NewPermissionService ¶ added in v2.0.4
func NewPermissionService( permissionRepository repository.IPermissionRepository, permissionCache cache.IPermissionCache, ) PermissionService
func (PermissionService) List ¶ added in v2.0.4
func (s PermissionService) List(ctx context.Context) ([]model.Permission, error)
func (PermissionService) Trx ¶ added in v2.0.4
func (s PermissionService) Trx(db *gorm.DB) IPermissionService
type RoleCreateInput ¶ added in v2.0.4
type RoleService ¶ added in v2.0.4
type RoleService struct {
// contains filtered or unexported fields
}
func NewRoleService ¶ added in v2.0.4
func NewRoleService( roleRepository repository.IRoleRepository, permissionRepository repository.IPermissionRepository, rolePermissionRepository repository.IRolePermissionRepository, userRoleRepository repository.IUserRoleRepository, userCache cache.IUserCache, tokenCache cache.ITokenCache, ) RoleService
func (RoleService) Create ¶ added in v2.0.4
func (s RoleService) Create(ctx context.Context, input RoleCreateInput) (*model.Role, error)
func (RoleService) Delete ¶ added in v2.0.4
func (s RoleService) Delete(ctx context.Context, id int) error
func (RoleService) Trx ¶ added in v2.0.4
func (s RoleService) Trx(db *gorm.DB) IRoleService
func (RoleService) Update ¶ added in v2.0.4
func (s RoleService) Update(ctx context.Context, id int, input RoleUpdateInput) error
type RoleUpdateInput ¶ added in v2.0.4
type SettingService ¶ added in v2.0.18
type SettingService struct {
// contains filtered or unexported fields
}
func NewSettingService ¶ added in v2.0.18
func NewSettingService( settingRepository repository.ISettingRepository, ) SettingService
func (SettingService) Trx ¶ added in v2.0.18
func (s SettingService) Trx(db *gorm.DB) ISettingService
func (SettingService) Update ¶ added in v2.0.18
func (s SettingService) Update(ctx context.Context, input SettingUpdateInput) error
type SettingUpdateInput ¶ added in v2.0.18
type SettingUpdateInput struct {
Settings *string
}
type UserCreateInput ¶ added in v2.0.4
type UserService ¶ added in v2.0.4
type UserService[Model, CreateInput, UpdateInput, UpdateProfileInput any] struct { // contains filtered or unexported fields }
func NewUserService ¶ added in v2.0.4
func NewUserService[Model, CreateInput, UpdateInput, UpdateProfileInput any]( profileService profile.IProfileService[Model, CreateInput, UpdateInput, UpdateProfileInput], userRepository repository.IUserRepository, roleRepository repository.IRoleRepository, userRoleRepository repository.IUserRoleRepository, userCache cache.IUserCache, tokenCache cache.ITokenCache, hasher secret.Hasher, ) UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]
func (UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Create ¶ added in v2.0.4
func (s UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Create(ctx context.Context, input UserCreateInput, profileInput *CreateInput) (*model.User, error)
func (UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Delete ¶ added in v2.0.4
func (s UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Delete(ctx context.Context, id int) error
func (UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Trx ¶ added in v2.0.4
func (s UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Trx(db *gorm.DB) IUserService[Model, CreateInput, UpdateInput, UpdateProfileInput]
func (UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Update ¶ added in v2.0.4
func (s UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Update(ctx context.Context, id int, input UserUpdateInput, profileInput *UpdateInput) error
Click to show internal directories.
Click to hide internal directories.