Documentation
¶
Overview ¶
This example demonstrates how to use the error handling system in servicelib.
Example of a basic ServiceLib application
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunErrorHandlingExample ¶
func RunErrorHandlingExample()
RunErrorHandlingExample demonstrates how to use the error handling system
Types ¶
type UserHandler ¶
type UserHandler struct {
// contains filtered or unexported fields
}
UserHandler is a simple HTTP handler that demonstrates error handling
func NewUserHandler ¶
func NewUserHandler(service *UserService) *UserHandler
NewUserHandler creates a new UserHandler
func (*UserHandler) GetUser ¶
func (h *UserHandler) GetUser(w http.ResponseWriter, r *http.Request)
GetUser handles GET requests for users
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService is a simple service that demonstrates error handling
func NewUserService ¶
func NewUserService(logger *logging.ContextLogger, meter metric.Meter) *UserService
NewUserService creates a new UserService
func (*UserService) GetUserByID ¶
GetUserByID retrieves a user by ID
func (*UserService) ValidateUser ¶
func (s *UserService) ValidateUser(ctx context.Context, user *User) error
ValidateUser validates a user
Directories
¶
| Path | Synopsis |
|---|---|
|
Example usage of creating an Auth instance
|
Example usage of creating an Auth instance |
|
Example of basic usage of the context package
|
Example of basic usage of the context package |
|
Example of basic usage of the date package
|
Example of basic usage of the date package |
|
Example of connecting to different database types
|
Example of connecting to different database types |
|
Example of basic usage of the dependency injection package
|
Example of basic usage of the dependency injection package |
|
This example demonstrates how to create different types of errors using the errors package.
|
This example demonstrates how to create different types of errors using the errors package. |
|
Example demonstrating how to configure the auth service for GraphQL
|
Example demonstrating how to configure the auth service for GraphQL |
|
Example of basic usage of the health package
|
Example of basic usage of the health package |
|
Example of basic usage of the logging package
|
Example of basic usage of the logging package |
|
Example of basic usage of the middleware package
|
Example of basic usage of the middleware package |
|
Example of basic repository implementation
|
Example of basic repository implementation |
|
Example of basic graceful shutdown
|
Example of basic graceful shutdown |
|
Example of basic signal handling
|
Example of basic signal handling |
|
Example of using HTTP instrumentation in the telemetry package
|
Example of using HTTP instrumentation in the telemetry package |
|
Example of basic saga transaction
|
Example of basic saga transaction |
|
Example of basic validation using the validation package
|
Example of basic validation using the validation package |
|
valueobject
|
|
|
appearance
Example usage of the Color value object
|
Example usage of the Color value object |
|
base
Example usage of the base value object types
|
Example usage of the base value object types |
|
contact
Example usage of the Email value object
|
Example usage of the Email value object |
|
identification
Example usage of the ID value object
|
Example usage of the ID value object |
|
location
Example usage of the Coordinate value object
|
Example usage of the Coordinate value object |
|
measurement
Example usage of the FileSize value object
|
Example usage of the FileSize value object |
|
network
Example usage of the IPAddress value object
|
Example usage of the IPAddress value object |
|
temporal
Example usage of the Time value object
|
Example usage of the Time value object |
Click to show internal directories.
Click to hide internal directories.