Skip to content

Lab 04: Database & Persistence - Mashchenko Pavel - #4

Open
PavMash wants to merge 1 commit into
mainfrom
lab04-mashchenko-pavel
Open

Lab 04: Database & Persistence - Mashchenko Pavel#4
PavMash wants to merge 1 commit into
mainfrom
lab04-mashchenko-pavel

Conversation

@PavMash

@PavMash PavMash commented Jul 9, 2025

Copy link
Copy Markdown
Owner

Lab 04: Database & Persistence

Overview

Implemented database connection and CRUD operations for backend. Experimented with different kinds of local storage and database in frontend.

What was implemented:

Go backend component:

  • Implemented database connection and migration
  • Implemented CRUD operations for user managing with manual SQL approach

Flutter frontend component:

  • Created class-inheritor of SharedPreferences and implemented CRUD methods for it
  • Created class-inheritor of SharedPreferences and implemented CRUD methods for it
  • Implemented local SQL database with CRUD and database managing operations

How to test:

Backend testing

  1. cd labs/lab02/backend
  2. go mod tidy
  3. go test ./...

Frontend testing

  1. cd labs/lab02/frontend
  2. flutter pub get
  3. flutter test
  4. It is okay, if secure_storage_service tests do not pass.

Checklist:

  • All tests pass
  • Code passes linting
  • Both Go and Flutter components work
  • Follows course coding standards

@github-actions

github-actions Bot commented Jul 9, 2025

Copy link
Copy Markdown

Lab 04 Test Results - Database & Persistence

🎯 Score: 5/6 (83.33333333333334%) - NECESSARY TASKS ONLY

🚀 Great progress! Almost mastered the core database operations!

📋 NECESSARY Task Completion:

Go Backend - NECESSARY Tasks

  • ✅ 🔴 Data Models (User & Post)
  • ✅ 🔴 Database Infrastructure
  • ✅ 🔴 Manual SQL Repository

Flutter Frontend - NECESSARY Tasks

  • ✅ 🔴 SharedPreferences Service
  • ✅ 🔴 SQLite Database Service
  • ❌ 🔴 Secure Storage Service

🔧 Component Details:

Backend (Go) - 3 NECESSARY Tasks:

  • 🔴 Models: User & Post structs with validation and JSON serialization
  • 🔴 Database: Connection management and goose migrations
  • 🔴 Repository: Manual SQL CRUD operations using database/sql

Frontend (Flutter) - 3 NECESSARY Tasks:

  • 🔴 SharedPreferences: Simple key-value storage for app settings
  • 🔴 SQLite Service: Local database operations with sqflite package
  • 🔴 Secure Storage: Encrypted storage for sensitive user data

🎯 OPTIONAL Learning Tasks:

After completing necessary tasks, explore these advanced patterns:

  • 🟡 Scany Mapping: Automatic struct mapping with raw SQL
  • 🟡 Squirrel Builder: Dynamic query building with fluent API
  • 🟡 GORM ORM: Full object-relational mapping with associations

💡 Next Steps:

  • Complete secure storage service for sensitive data

🛠️ Migration Commands

Use these Makefile commands for database management:

  • make migrate-up - Run all migrations
  • make migrate-down - Rollback last migration
  • make migrate-status - Check migration status
  • make setup-db - Fresh database setup

Explore different storage patterns and database approaches! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant