Reusable packages for Go applications
go get github.com/mwinyimoha/commonsCustom error handling with support for error wrapping and categorization. Uses a custom type that implements Go's Error interface. The package supports:
- Reporting field violations as extra information in validation errors
- Error wrapping with custom context and error codes
- Standard error types:
InvalidArgument,NotFound,Internal, etc. - Structured error responses for APIs. Includes Google-style error enrichment for gRPC APIs
Structured logging utilities for consistent log output across applications. Uses Zap under the hood and supports:
- Contextual logging with key-value pairs
- Multiple log levels: Debug, Info, Warning, Error
- Integration with standard Go logging patterns
Struct conversion and serialization utilities. Uses Copier under the hood and supports:
- Automatic conversion between struct types
- Built in hooks for common conversions e.g
uuid <-> string - Extensible hook system for custom field type conversions
- Batch serialization for slices