Utility Packages Reference
Dokumentasi lengkap semua utility packages yang tersedia di MStore Backend (pkg/utils/).
📊 Package Overview
🔴 HIGH PRIORITY
1. OpenTelemetry (OTEL)
Package:pkg/utils/logger/otel.goDocumentation: OpenTelemetry Tracing Quick Example:
2. Snowflake ID Generator
Package:pkg/utils/snowflake/Documentation: Snowflake ID Generator Quick Example:
3. Transaction Code Generator
Package:pkg/utils/txcode/Documentation: Transaction Code Generator Quick Example:
4. Logger
Package:pkg/utils/logger/
Features:
- Structured logging (Zap)
- Log levels (Debug, Info, Warn, Error)
- Loki integration
- OTEL integration
- Sensitive data sanitization
🟡 MEDIUM PRIORITY
5. Message Broker
Package:pkg/utils/message_broker/Documentation: Message Broker & Event-Driven Supported Brokers:
- Kafka - Event streaming
- NATS - Microservice RPC
- RabbitMQ - Task queues
- MQTT - IoT devices
- Redis Pub/Sub - Real-time notifications
6. Cache (Redis)
Package:pkg/utils/cache/redis.go
Features:
- Redis connection management
- Get/Set/Delete operations
- TTL support
- Pub/Sub
7. Database (MySQL)
Package:pkg/utils/database/
Features:
- MySQL connection pooling
- Transaction management
- Query helpers
- Migration support
8. AWS Utils
Package:pkg/utils/aws/
Features:
- S3 file upload/download
- Cognito authentication
- Session management
9. Google Utils (Firebase)
Package:pkg/utils/google/firebase.go
Features:
- Firebase Authentication
- Push Notifications (FCM)
- Firestore operations
10. Excel Utils
Package:pkg/utils/excel/
Features:
- Read Excel files
- Write Excel files
- Template support
- Data validation
11. Hash & Crypto
Package:pkg/utils/hash/
Features:
- Password hashing (bcrypt)
- Token generation
- Encryption/Decryption
12. JWT
Package:pkg/utils/jwt/
Features:
- JWT token generation
- Token validation
- Refresh tokens
- Claims extraction
13. HTTP Utils
Package:pkg/utils/http/
Features:
- HTTP client wrapper
- Request/Response helpers
- Retry logic
- Timeout handling
14. gRPC Utils
Package:pkg/utils/grpc/
Features:
- gRPC client setup
- gRPC server setup
- Interceptors
- Load balancing
15. Validator
Package:pkg/utils/validator/
Features:
- Struct validation
- Custom validation rules
- Error messages
16. Feature Flag
Package:pkg/utils/featureflag/goff.goDocumentation: Feature Flags Quick Example:
17. ID Generator
Package:pkg/utils/id_generator/
Features:
- UUID generation
- ULID generation
- Custom ID formats
🟢 LOW PRIORITY
18. Filter Utils
Package:pkg/utils/filter/array.go
Quick Example:
19. Mapper Utils
Package:pkg/utils/mapper/
Quick Example:
20. Transform Utils
Package:pkg/utils/transform/
Quick Example:
21. Time Utils
Package:pkg/utils/time/
Quick Example:
22. Lang (Localization)
Package:pkg/utils/lang/
Quick Example:
23. Parser Utils
Package:pkg/utils/parser/
Quick Example:
24. Payload Utils
Package:pkg/utils/payload/
Quick Example:
25. Response Utils
Package:pkg/utils/response/
Quick Example:
26. Pagination
Package:pkg/utils/pagination/
Quick Example:
27. Error Utils
Package:pkg/utils/error/
Quick Example:
28. File Utils
Package:pkg/utils/file/
Quick Example:
29. Finance Utils
Package:pkg/utils/finance/
Quick Example:
30. Unit Test Utils
Package:pkg/utils/unit_test/
Quick Example:
📚 Quick Reference
Import Paths
📚 Related Documentation
OpenTelemetry Tracing
Distributed tracing guide
Snowflake ID Generator
Distributed ID generation
Transaction Code Generator
Human-readable codes
Message Broker
Event-driven architecture
Feature Flags
Feature flag management
Tech Stack
Complete tech stack
Utility Packages: Semua 30 utility packages terdokumentasi lengkap. Gunakan sesuai kebutuhan dan ikuti best practices yang ada.