Documentation ¶
Overview ¶
Package users is a generated GoMock package.
Index ¶
- Variables
- type GormService
- func (s *GormService) AuthByCreds(ctx context.Context, username, password string) (*model.User, error)
- func (s *GormService) AuthByID(ctx context.Context, userID string) (*model.User, error)
- func (s *GormService) Column(ctx context.Context, name, col string, val any) error
- func (s *GormService) Create(ctx context.Context, record *model.User) error
- func (s *GormService) Delete(ctx context.Context, name string) error
- func (s *GormService) Exists(ctx context.Context, name string) (bool, error)
- func (s *GormService) External(ctx context.Context, provider, ref, username, email, fullname string, ...) (*model.User, error)
- func (s *GormService) List(ctx context.Context, params model.ListParams) ([]*model.User, int64, error)
- func (s *GormService) Show(ctx context.Context, name string) (*model.User, error)
- func (s *GormService) Update(ctx context.Context, record *model.User) error
- func (s *GormService) WithPrincipal(principal *model.User) Service
- type MockService
- func (m *MockService) AuthByCreds(arg0 context.Context, arg1, arg2 string) (*model.User, error)
- func (m *MockService) AuthByID(arg0 context.Context, arg1 string) (*model.User, error)
- func (m *MockService) Column(arg0 context.Context, arg1, arg2 string, arg3 any) error
- func (m *MockService) Create(arg0 context.Context, arg1 *model.User) error
- func (m *MockService) Delete(arg0 context.Context, arg1 string) error
- func (m *MockService) EXPECT() *MockServiceMockRecorder
- func (m *MockService) Exists(arg0 context.Context, arg1 string) (bool, error)
- func (m *MockService) External(arg0 context.Context, arg1, arg2, arg3, arg4, arg5 string, arg6 bool) (*model.User, error)
- func (m *MockService) List(arg0 context.Context, arg1 model.ListParams) ([]*model.User, int64, error)
- func (m *MockService) Show(arg0 context.Context, arg1 string) (*model.User, error)
- func (m *MockService) Update(arg0 context.Context, arg1 *model.User) error
- func (m *MockService) WithPrincipal(arg0 *model.User) Service
- type MockServiceMockRecorder
- func (mr *MockServiceMockRecorder) AuthByCreds(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) AuthByID(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) Column(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) Create(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) Exists(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) External(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) List(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) Show(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) Update(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockServiceMockRecorder) WithPrincipal(arg0 interface{}) *gomock.Call
- type Service
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is returned when a user was not found. ErrNotFound = errors.New("user not found") // ErrBadCredentials is returned when credentials are wrong. ErrBadCredentials = errors.New("wrong credentials provided") )
Functions ¶
This section is empty.
Types ¶
type GormService ¶
type GormService struct {
// contains filtered or unexported fields
}
GormService defines the service to store content within a database based on Gorm.
func NewGormService ¶
func NewGormService( handle *gorm.DB, cfg *config.Config, ) *GormService
NewGormService initializes the service to store content within a database based on Gorm.
func (*GormService) AuthByCreds ¶
func (s *GormService) AuthByCreds(ctx context.Context, username, password string) (*model.User, error)
AuthByCreds implements the Service interface.
func (*GormService) Delete ¶
func (s *GormService) Delete(ctx context.Context, name string) error
Delete implements the Service interface for database persistence.
func (*GormService) External ¶
func (s *GormService) External(ctx context.Context, provider, ref, username, email, fullname string, admin bool) (*model.User, error)
External implements the Service interface for database persistence.
func (*GormService) List ¶
func (s *GormService) List(ctx context.Context, params model.ListParams) ([]*model.User, int64, error)
List implements the Service interface for database persistence.
func (*GormService) WithPrincipal ¶
func (s *GormService) WithPrincipal(principal *model.User) Service
WithPrincipal implements the Service interface for database persistence.
type MockService ¶
type MockService struct {
// contains filtered or unexported fields
}
MockService is a mock of Service interface.
func NewMockService ¶
func NewMockService(ctrl *gomock.Controller) *MockService
NewMockService creates a new mock instance.
func (*MockService) AuthByCreds ¶
AuthByCreds mocks base method.
func (*MockService) Delete ¶
func (m *MockService) Delete(arg0 context.Context, arg1 string) error
Delete mocks base method.
func (*MockService) EXPECT ¶
func (m *MockService) EXPECT() *MockServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockService) External ¶
func (m *MockService) External(arg0 context.Context, arg1, arg2, arg3, arg4, arg5 string, arg6 bool) (*model.User, error)
External mocks base method.
func (*MockService) List ¶
func (m *MockService) List(arg0 context.Context, arg1 model.ListParams) ([]*model.User, int64, error)
List mocks base method.
func (*MockService) WithPrincipal ¶
func (m *MockService) WithPrincipal(arg0 *model.User) Service
WithPrincipal mocks base method.
type MockServiceMockRecorder ¶
type MockServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockServiceMockRecorder is the mock recorder for MockService.
func (*MockServiceMockRecorder) AuthByCreds ¶
func (mr *MockServiceMockRecorder) AuthByCreds(arg0, arg1, arg2 interface{}) *gomock.Call
AuthByCreds indicates an expected call of AuthByCreds.
func (*MockServiceMockRecorder) AuthByID ¶
func (mr *MockServiceMockRecorder) AuthByID(arg0, arg1 interface{}) *gomock.Call
AuthByID indicates an expected call of AuthByID.
func (*MockServiceMockRecorder) Column ¶
func (mr *MockServiceMockRecorder) Column(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
Column indicates an expected call of Column.
func (*MockServiceMockRecorder) Create ¶
func (mr *MockServiceMockRecorder) Create(arg0, arg1 interface{}) *gomock.Call
Create indicates an expected call of Create.
func (*MockServiceMockRecorder) Delete ¶
func (mr *MockServiceMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockServiceMockRecorder) Exists ¶
func (mr *MockServiceMockRecorder) Exists(arg0, arg1 interface{}) *gomock.Call
Exists indicates an expected call of Exists.
func (*MockServiceMockRecorder) External ¶
func (mr *MockServiceMockRecorder) External(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call
External indicates an expected call of External.
func (*MockServiceMockRecorder) List ¶
func (mr *MockServiceMockRecorder) List(arg0, arg1 interface{}) *gomock.Call
List indicates an expected call of List.
func (*MockServiceMockRecorder) Show ¶
func (mr *MockServiceMockRecorder) Show(arg0, arg1 interface{}) *gomock.Call
Show indicates an expected call of Show.
func (*MockServiceMockRecorder) Update ¶
func (mr *MockServiceMockRecorder) Update(arg0, arg1 interface{}) *gomock.Call
Update indicates an expected call of Update.
func (*MockServiceMockRecorder) WithPrincipal ¶
func (mr *MockServiceMockRecorder) WithPrincipal(arg0 interface{}) *gomock.Call
WithPrincipal indicates an expected call of WithPrincipal.
type Service ¶
type Service interface { External(context.Context, string, string, string, string, string, bool) (*model.User, error) AuthByID(context.Context, string) (*model.User, error) AuthByCreds(context.Context, string, string) (*model.User, error) List(context.Context, model.ListParams) ([]*model.User, int64, error) Show(context.Context, string) (*model.User, error) Create(context.Context, *model.User) error Update(context.Context, *model.User) error Delete(context.Context, string) error Exists(context.Context, string) (bool, error) Column(context.Context, string, string, any) error WithPrincipal(*model.User) Service }
Service handles all interactions with users.
func NewLoggingService ¶
NewLoggingService wraps the Service and provides logging for its methods.
func NewMetricsService ¶
NewMetricsService wraps the Service and provides metrics for its methods.
func NewService ¶
NewService returns a Service that handles all interactions with users.