Documentation
¶
Index ¶
- Variables
- type AuthLogin
- type AuthLogout
- type AuthRefresh
- type AuthService
- func (s AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Account(ctx context.Context) (*model2.User, error)
- func (s AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Login(ctx context.Context, input AuthLogin) (*model2.AuthToken, int, error)
- func (s AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Logout(ctx context.Context, input AuthLogout) (int, error)
- func (s AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Refresh(ctx context.Context, input AuthRefresh) (*model2.AuthToken, int, error)
- func (s AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) SSO(ctx context.Context, input SSO) (*model2.AuthToken, int, 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 FilterCreateInput
- type FilterService
- func (s FilterService) Create(ctx context.Context, input FilterCreateInput) (*model.Filter, error)
- func (s FilterService) Delete(ctx context.Context, id int) error
- func (s FilterService) GetById(ctx context.Context, id int) (*model.Filter, error)
- func (s FilterService) List(ctx context.Context, m *model2.Meta[model.Filter]) error
- func (s FilterService) Trx(db *gorm.DB) IFilterService
- func (s FilterService) Update(ctx context.Context, id int, input FilterUpdateInput) error
- type FilterUpdateInput
- type IAuthService
- type IFilterService
- type IPermissionService
- type IRoleService
- type ISessionService
- type ISettingService
- type IUserService
- type IVersionService
- 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
- func (s RoleService) UserList(ctx context.Context, id int, m *model2.Meta[model.UserRole]) error
- type RoleUpdateInput
- type SSO
- type SessionService
- 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
- type VersionService
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAuthNoAccess = apperr.New("auth_no_access", apperr.WithTextTranslate(i18n.ErrAuthNoAccess), apperr.WithCode(code.PermissionDenied)) ErrAuthBlocked = apperr.New("auth_blocked", apperr.WithTextTranslate(i18n.ErrAuthNoAccess), apperr.WithCode(code.PermissionDenied)) ErrSSONotSupported = apperr.New("sso_not_supported", apperr.WithTextTranslate(i18n.ErrSSONotSupported), apperr.WithCode(code.Unauthenticated)) )
View Source
var ( ErrFilterNotFound = apperr.New("filter_not_found", apperr.WithTextTranslate(i18n.ErrFilterNotFound), apperr.WithCode(code.NotFound)) ErrFilterExists = apperr.New("filter_exists_error", apperr.WithTextTranslate(i18n.ErrFilterExists), apperr.WithCode(code.AlreadyExists)) )
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.AlreadyExists)) 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.AlreadyExists)) ErrUserRolesCannotBeChanged = apperr.New("user_roles_cannot_be_changed", apperr.WithTextTranslate(i18n.ErrUserRolesCannotBeChanged), apperr.WithCode(code.PermissionDenied)) ErrUserCannotBeBlocked = apperr.New("user_cannot_be_blocked", apperr.WithTextTranslate(i18n.ErrUserCannotBeBlocked), apperr.WithCode(code.PermissionDenied)) ErrUserCannotBeDeleted = apperr.New("user_cannot_be_deleted", apperr.WithTextTranslate(i18n.ErrUserCannotBeDeleted), apperr.WithCode(code.PermissionDenied)) ErrSelfCannotBeDeleted = apperr.New("self_cannot_be_deleted", apperr.WithTextTranslate(i18n.ErrSelfCannotBeDeleted), apperr.WithCode(code.PermissionDenied)) )
View Source
var (
ErrSessionNotFound = apperr.New("session_not_found", apperr.WithTextTranslate(i18n.ErrSessionNotFound), apperr.WithCode(code.NotFound))
)
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 repository2.IUserRepository, tokenRepository repository2.ITokenRepository, tokenCache cache2.ITokenCache, userCache cache2.IUserCache, hasher secret.Hasher, accessExpire time.Duration, refreshExpire time.Duration, accessSecret string, ldapAuth ldap.AuthService, oidcAuth oidc.AuthService, samlAuth saml.AuthService, ) 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) (int, error)
func (AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Refresh ¶
func (s AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Refresh(ctx context.Context, input AuthRefresh) (*model2.AuthToken, int, 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 ¶
func (s AuthService[Model, CreateInput, UpdateInput, UpdateProfileInput]) UpdateAccountData(ctx context.Context, input AuthUpdateAccountData, profileInput *UpdateProfileInput) error
type AuthUpdateAccountData ¶
type FilterCreateInput ¶ added in v2.3.99
type FilterService ¶ added in v2.3.99
type FilterService struct {
// contains filtered or unexported fields
}
func NewFilterService ¶ added in v2.3.99
func NewFilterService( filterRepository repository2.IFilterRepository, ) FilterService
func (FilterService) Create ¶ added in v2.3.99
func (s FilterService) Create(ctx context.Context, input FilterCreateInput) (*model.Filter, error)
func (FilterService) Delete ¶ added in v2.3.99
func (s FilterService) Delete(ctx context.Context, id int) error
func (FilterService) Trx ¶ added in v2.3.99
func (s FilterService) Trx(db *gorm.DB) IFilterService
func (FilterService) Update ¶ added in v2.3.99
func (s FilterService) Update(ctx context.Context, id int, input FilterUpdateInput) error
type FilterUpdateInput ¶ added in v2.3.99
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) (*model2.AuthToken, int, error) Refresh(ctx context.Context, input AuthRefresh) (*model2.AuthToken, int, error) Logout(ctx context.Context, input AuthLogout) (int, error) Account(ctx context.Context) (*model2.User, error) UpdateAccountData(ctx context.Context, input AuthUpdateAccountData, profileInput *UpdateProfileInput) error SSO(ctx context.Context, input SSO) (*model2.AuthToken, int, error) }
type IFilterService ¶ added in v2.3.99
type IFilterService interface { Trx(db *gorm.DB) IFilterService List(ctx context.Context, m *model2.Meta[model.Filter]) error GetById(ctx context.Context, id int) (*model.Filter, error) Create(ctx context.Context, input FilterCreateInput) (*model.Filter, error) Update(ctx context.Context, id int, input FilterUpdateInput) error Delete(ctx context.Context, id int) error }
type IPermissionService ¶
type IPermissionService interface { Trx(db *gorm.DB) IPermissionService List(ctx context.Context) ([]model.Permission, error) }
type IRoleService ¶
type IRoleService interface { Trx(db *gorm.DB) IRoleService List(ctx context.Context, m *model2.Meta[model.Role]) error UserList(ctx context.Context, id int, m *model2.Meta[model.UserRole]) 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 ISessionService ¶ added in v2.3.7
type ISettingService ¶
type IUserService ¶
type IUserService[Model profile.IModel, 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 IVersionService ¶ added in v2.3.155
type PermissionService ¶
type PermissionService struct {
// contains filtered or unexported fields
}
func NewPermissionService ¶
func NewPermissionService( permissionRepository repository.IPermissionRepository, permissionCache cache.IPermissionCache, ) PermissionService
func (PermissionService) List ¶
func (s PermissionService) List(ctx context.Context) ([]model.Permission, error)
func (PermissionService) Trx ¶
func (s PermissionService) Trx(db *gorm.DB) IPermissionService
type RoleCreateInput ¶
type RoleService ¶
type RoleService struct {
// contains filtered or unexported fields
}
func NewRoleService ¶
func NewRoleService( roleRepository repository2.IRoleRepository, permissionRepository repository2.IPermissionRepository, rolePermissionRepository repository2.IRolePermissionRepository, userRoleRepository repository2.IUserRoleRepository, userCache cache2.IUserCache, tokenCache cache2.ITokenCache, ) RoleService
func (RoleService) Create ¶
func (s RoleService) Create(ctx context.Context, input RoleCreateInput) (*model.Role, error)
func (RoleService) Trx ¶
func (s RoleService) Trx(db *gorm.DB) IRoleService
func (RoleService) Update ¶
func (s RoleService) Update(ctx context.Context, id int, input RoleUpdateInput) error
type RoleUpdateInput ¶
type SessionService ¶ added in v2.3.7
type SessionService struct {
// contains filtered or unexported fields
}
func NewSessionService ¶ added in v2.3.7
func NewSessionService( tokenRepository repository2.ITokenRepository, tokenCache cache2.ITokenCache, userCache cache2.IUserCache, refreshExpire time.Duration, ) SessionService
func (SessionService) End ¶ added in v2.3.7
func (s SessionService) End(ctx context.Context, id int) error
func (SessionService) List ¶ added in v2.3.7
func (s SessionService) List(ctx context.Context, m *model3.Meta[model2.RefreshToken]) error
func (SessionService) Trx ¶ added in v2.3.7
func (s SessionService) Trx(db *gorm.DB) ISessionService
type SettingService ¶
type SettingService struct {
// contains filtered or unexported fields
}
func NewSettingService ¶
func NewSettingService( settingRepository repository.ISettingRepository, ) SettingService
func (SettingService) Trx ¶
func (s SettingService) Trx(db *gorm.DB) ISettingService
func (SettingService) Update ¶
func (s SettingService) Update(ctx context.Context, input SettingUpdateInput) error
type SettingUpdateInput ¶
type SettingUpdateInput struct {
Settings *string
}
type UserCreateInput ¶
type UserService ¶
type UserService[Model profile.IModel, CreateInput, UpdateInput, UpdateProfileInput any] struct { // contains filtered or unexported fields }
func NewUserService ¶
func NewUserService[Model profile.IModel, CreateInput, UpdateInput, UpdateProfileInput any]( profileService profile.IProfileService[Model, CreateInput, UpdateInput, UpdateProfileInput], userRepository repository2.IUserRepository, roleRepository repository2.IRoleRepository, userRoleRepository repository2.IUserRoleRepository, userCache cache2.IUserCache, tokenCache cache2.ITokenCache, hasher secret.Hasher, ) UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]
func (UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Create ¶
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 ¶
func (s UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Delete(ctx context.Context, id int) error
func (UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Trx ¶
func (s UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Trx(db *gorm.DB) IUserService[Model, CreateInput, UpdateInput, UpdateProfileInput]
func (UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Update ¶
func (s UserService[Model, CreateInput, UpdateInput, UpdateProfileInput]) Update(ctx context.Context, id int, input UserUpdateInput, profileInput *UpdateInput) error
type UserUpdateInput ¶
type VersionService ¶ added in v2.3.155
type VersionService struct {
// contains filtered or unexported fields
}
func NewVersionService ¶ added in v2.3.155
func NewVersionService(version string, migrationRepository repository.IMigrationRepository) VersionService
Click to show internal directories.
Click to hide internal directories.