Conversation
- Go project initialization - GitHub Actions workflow for: * Branch validation * golangci-lint * Unit tests with coverage * Multi-platform builds * Artifact uploads
feat: add basic note entity structure and tests
- Move Entity interface from internal/model/common.go to internal/repository/repository.go - Interface now better aligns with repository layer responsibility - Remove empty common.go file from model package
feat: add slice storage and interface-based distribution
…change logging - Refactored the service to have two independent goroutines: one for data generation and one for data saving - Implemented a third logging goroutine that checks for changes every 200ms and logs only new entities - Fixed the repository's Save method to be synchronous as per reviewer's feedback - Moved all channel logic to the service level - Updated all tests to match the new architecture - Ensured thread-safe concurrent access to slices from different goroutines
feature/goroutines and channels study
Implement graceful shutdown using context and OS signals
- Implement JSON file-based repository with automatic data persistence - Add repository factory pattern supporting both RAM and JSON storage types - Create logging mechanism to monitor data changes in real-time - Implement automatic data loading from JSON files on application startup
…es from file - Add initialNotesCount field to JSONRepository to track notes loaded from file - Modify GetNewNotes method to exclude loaded notes from 'new' count - Update LoadFromStorage to set initial notes count after loading - Keep only summary message about loaded notes count
Implement concurrent note generation with persistent JSON storage
This commit introduces new server implementations and removes obsolete components that were previously used for test data generation: - Added gRPC server and client implementations with full CRUD operations - Added web server with REST API endpoints and Gin framework - Implemented JWT-based authentication and authorization middleware - Added Swagger documentation for REST API endpoints - Removed obsolete internal/service package (used for test data generation) - Removed obsolete internal/logger package (used for monitoring test data) The new servers provide complete API functionality, making the old test data generation components redundant.
- Change route to add the new Note from /api/notes/ to /api/notes - Added clarification that curly braces are not part of JWT token - Added debug logging to middleware and handlers
…s and repositories
REST API and gRPC servers with JWT authentication and Swagger documentation
…ive validation checks
Add comprehensive tests, benchmarks, and improve documentation and infrastructure
…ion support Key Changes: 1. Common Base Repository Structure: - Created `internal/repository/postgres/base_repository.go` with shared functionality for all repositories - Implemented `BaseRepository` struct with common methods: `WithContext()`, `SetTransaction()`, `ClearTransaction()`, `Exec()`, `QueryRow()`, and `Query()` - Refactored both `PostgresNoteRepository` and `PostgresUserRepository` to embed the base repository - Centralized context management with configurable timeouts 2. Enhanced Error Handling System: - Extended `internal/repository/postgres/errors/errors.go` with structured error hierarchy - Added `ErrorCode` type and `RepositoryError` struct with error codes, messages, and entity information - Implemented specific error creation functions (e.g., `NewNoteNotFoundError`, `NewUserCreationError`) - Maintained backward compatibility by preserving original error variables 3. Repository Options Pattern: - Created `internal/repository/postgres/repository_options.go` with `RepositoryOption` type - Added `WithTimeout` option for configurable timeouts - Implemented `NewPostgresNoteRepositoryWithOpts` and `NewPostgresUserRepositoryWithOpts` for advanced configuration - Preserved original constructors for backward compatibility 4. Transaction Support: - Added `internal/repository/postgres/transaction_manager.go` with `TransactionManager` interface - Implemented `PostgresTransactionManager` with `WithinTransaction` method - Enhanced base repository to support transaction operations - Added methods to set and clear transactions on repository instances 5. Repository Refactoring: - Updated `note_repository.go` and `user_repository.go` to use base repository methods - Replaced direct database calls with base repository methods (`Exec`, `QueryRow`, `Query`) - Added proper error wrapping using enhanced error system - Implemented proper PostgreSQL error handling (e.g., checking for `pgx.ErrNoRows`) 6. Backward Compatibility: - All existing interfaces remain unchanged - Original constructor signatures preserved (`NewPostgresNoteRepository`, `NewPostgresUserRepository`) - All existing tests continue to pass without modification - Applications (web-server, grpc-server) continue to work without changes - Benchmark tests remain functional
Refactor postgres base repository with error constants extraction
Add Docker support, versioning info, and systemd service files for gRPC and Web servers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.