Documentation
¶
Overview ¶
Package repository implements different repository services required by the user service
Package repository implements different repository services required by the user service ¶
Package repository implements different repository services required by the user service
Index ¶
- func IsUnknownError(err error) bool
- func IsUserAlreadyExistsError(err error) bool
- func IsUserNotFoundError(err error) bool
- func NewUnknownError(message string) error
- func NewUnknownErrorWithError(message string, err error) error
- func NewUserAlreadyExistsError() error
- func NewUserAlreadyExistsErrorWithError(err error) error
- func NewUserNotFoundError(email string) error
- func NewUserNotFoundErrorWithError(email string, err error) error
- type CreateUserRequest
- type CreateUserResponse
- type DeleteUserRequest
- type DeleteUserResponse
- type ReadUserRequest
- type ReadUserResponse
- type RepositoryContract
- type UnknownError
- type UpdateUserRequest
- type UpdateUserResponse
- type UserAlreadyExistsError
- type UserNotFoundError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsUnknownError ¶
IsUnknownError indicates whether the error is of type UnknownError
func IsUserAlreadyExistsError ¶
IsUserAlreadyExistsError indicates whether the error is of type UserAlreadyExistsError
func IsUserNotFoundError ¶
IsUserNotFoundError indicates whether the error is of type UserNotFoundError
func NewUnknownError ¶
NewUnknownError creates a new UnknownError error
func NewUnknownErrorWithError ¶
NewUnknownErrorWithError creates a new UnknownError error
func NewUserAlreadyExistsError ¶
func NewUserAlreadyExistsError() error
NewUserAlreadyExistsError creates a new UserAlreadyExistsError error
func NewUserAlreadyExistsErrorWithError ¶
NewUserAlreadyExistsErrorWithError creates a new UserAlreadyExistsError error
func NewUserNotFoundError ¶
NewUserNotFoundError creates a new UserNotFoundError error email: Mandatory. The email address that did not match any existing user
func NewUserNotFoundErrorWithError ¶
NewUserNotFoundErrorWithError creates a new UserNotFoundError error email: Mandatory. The email address that did not match any existing user
Types ¶
type CreateUserRequest ¶
CreateUserRequest contains the request to create a new user
type CreateUserResponse ¶
CreateUserResponse contains the result of creating a new user
type DeleteUserRequest ¶
type DeleteUserRequest struct {
Email string
}
DeleteUserRequest contains the request to delete an existing user
type DeleteUserResponse ¶
type DeleteUserResponse struct { }
DeleteUserResponse contains the result of deleting an existing user
type ReadUserRequest ¶
type ReadUserRequest struct {
Email string
}
ReadUserRequest contains the request to read an existing user
type ReadUserResponse ¶
ReadUserResponse contains the result of reading an existing user
type RepositoryContract ¶
type RepositoryContract interface { // CreateUser creates a new user. // ctx: Mandatory The reference to the context // request: Mandatory. The request to create a new user // Returns either the result of creating new user or error if something goes wrong. CreateUser( ctx context.Context, request *CreateUserRequest) (*CreateUserResponse, error) // ReadUser read an existing user // ctx: Mandatory The reference to the context // request: Mandatory. The request to read an existing user // Returns either the result of reading an existing user or error if something goes wrong. ReadUser( ctx context.Context, request *ReadUserRequest) (*ReadUserResponse, error) // UpdateUser update an existing user // ctx: Mandatory The reference to the context // request: Mandatory. The request to update an existing user // Returns either the result of updateing an existing user or error if something goes wrong. UpdateUser( ctx context.Context, request *UpdateUserRequest) (*UpdateUserResponse, error) // DeleteUser delete an existing user // ctx: Mandatory The reference to the context // request: Mandatory. The request to delete an existing user // Returns either the result of deleting an existing user or error if something goes wrong. DeleteUser( ctx context.Context, request *DeleteUserRequest) (*DeleteUserResponse, error) }
RepositoryContract declares the repository service that can create new user, read, update and delete existing users.
type UnknownError ¶
UnknownError indicates that an unknown error has happened
func (UnknownError) Error ¶
func (e UnknownError) Error() string
Error returns message for the UnknownError error type Returns the error nessage
func (UnknownError) Unwrap ¶
func (e UnknownError) Unwrap() error
Unwrap returns the err if provided through NewUnknownErrorWithError function, otherwise returns nil
type UpdateUserRequest ¶
UpdateUserRequest contains the request to update an existing user
type UpdateUserResponse ¶
UpdateUserResponse contains the result of updating an existing user
type UserAlreadyExistsError ¶
type UserAlreadyExistsError struct {
Err error
}
UserAlreadyExistsError indicates that the user with the given information already exists
func (UserAlreadyExistsError) Error ¶
func (e UserAlreadyExistsError) Error() string
Error returns message for the UserAlreadyExistsError error type Returns the error nessage
func (UserAlreadyExistsError) Unwrap ¶
func (e UserAlreadyExistsError) Unwrap() error
Unwrap returns the err if provided through NewUserAlreadyExistsErrorWithError function, otherwise returns nil
type UserNotFoundError ¶
UserNotFoundError indicates that the user with the given email address does not exist
func (UserNotFoundError) Error ¶
func (e UserNotFoundError) Error() string
Error returns message for the UserNotFoundError error type Returns the error nessage
func (UserNotFoundError) Unwrap ¶
func (e UserNotFoundError) Unwrap() error
Unwrap returns the err if provided through UserNotFoundError function, otherwise returns nil