docs: translate remaining architectural guides to German and standardize formatting
Translated all remaining English architectural documents into German, including ADRs, guides, release notes, and reference materials. Standardized formatting across translated files, updated section headings, and localized inline comments within code examples for consistency.
This commit is contained in:
@@ -3,13 +3,13 @@ type: Guide
|
||||
status: ACTIVE
|
||||
owner: Frontend Expert
|
||||
---
|
||||
# SQLDelight Integration in Compose Multiplatform
|
||||
# SQLDelight-Integration in Compose Multiplatform
|
||||
|
||||
This guide shows how to integrate SQLDelight in a Compose Multiplatform project with Koin dependency injection.
|
||||
Diese Anleitung zeigt, wie SQLDelight in einem Compose Multiplatform-Projekt mit Koin Dependency Injection integriert wird.
|
||||
|
||||
## Step 1: Add Dependencies
|
||||
## Schritt 1: Abhängigkeiten hinzufügen
|
||||
|
||||
Add below dependencies In `gradle/libs.versions.toml`:
|
||||
Folgende Abhängigkeiten in `gradle/libs.versions.toml` eintragen:
|
||||
|
||||
```toml
|
||||
[versions]
|
||||
@@ -28,7 +28,7 @@ koin-compose = { module = "io.insert-koin:koin-compose", version.ref = "koin" }
|
||||
sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" }
|
||||
```
|
||||
|
||||
In `build.gradle.kts` (project level):
|
||||
In `build.gradle.kts` (Projektebene):
|
||||
|
||||
```kotlin
|
||||
plugins {
|
||||
@@ -75,13 +75,13 @@ sqldelight {
|
||||
|
||||
```
|
||||
|
||||
##Step 2: Create SQL Schema
|
||||
## Schritt 2: SQL-Schema erstellen
|
||||
|
||||
**Create directory structure:**
|
||||
**Verzeichnisstruktur anlegen:**
|
||||
|
||||
`shared/src/commonMain/sqldelight/com/example/database/`
|
||||
|
||||
Create `User.sq` file:
|
||||
Datei `User.sq` erstellen:
|
||||
|
||||
```sql
|
||||
CREATE TABLE User
|
||||
@@ -91,48 +91,48 @@ CREATE TABLE User
|
||||
imageUrl TEXT
|
||||
);
|
||||
|
||||
-- Insert a new user
|
||||
-- Neuen Benutzer einfügen
|
||||
insertUser
|
||||
:
|
||||
::
|
||||
INSERT INTO User(name, imageUrl)
|
||||
VALUES (?, ?);
|
||||
|
||||
-- Get all users
|
||||
-- Alle Benutzer abrufen
|
||||
getAllUsers
|
||||
:
|
||||
::
|
||||
SELECT *
|
||||
FROM User;
|
||||
|
||||
-- Get user by ID
|
||||
-- Benutzer nach ID abrufen
|
||||
getUserById
|
||||
:
|
||||
::
|
||||
SELECT *
|
||||
FROM User
|
||||
WHERE id = ?;
|
||||
|
||||
-- Update user
|
||||
-- Benutzer aktualisieren
|
||||
updateUser
|
||||
:
|
||||
::
|
||||
UPDATE User
|
||||
SET name = ?,
|
||||
imageUrl = ?
|
||||
WHERE id = ?;
|
||||
|
||||
-- Delete user
|
||||
-- Benutzer löschen
|
||||
deleteUser
|
||||
:
|
||||
::
|
||||
DELETE
|
||||
FROM User
|
||||
WHERE id = ?;
|
||||
|
||||
-- Delete all users
|
||||
-- Alle Benutzer löschen
|
||||
deleteAllUsers
|
||||
:
|
||||
::
|
||||
DELETE
|
||||
FROM User;
|
||||
```
|
||||
|
||||
## Step 3: Create Database Driver Interface
|
||||
## Schritt 3: Datenbank-Treiber-Interface erstellen
|
||||
|
||||
In `shared/src/commonMain/kotlin/database/DatabaseDriverFactory.kt`:
|
||||
|
||||
@@ -146,7 +146,7 @@ expect class DatabaseDriverFactory {
|
||||
}
|
||||
```
|
||||
|
||||
## Step 4: Platform-Specific Implementations
|
||||
## Schritt 4: Plattformspezifische Implementierungen
|
||||
|
||||
### Android —
|
||||
|
||||
@@ -211,7 +211,7 @@ actual class DatabaseDriverFactory {
|
||||
|
||||
```
|
||||
|
||||
## Step 5: Create Repository
|
||||
## Schritt 5: Repository erstellen
|
||||
|
||||
In `shared/src/commonMain/kotlin/repository/UserRepository.kt`:
|
||||
|
||||
@@ -255,7 +255,7 @@ class UserRepository(private val database: AppDatabase) {
|
||||
|
||||
```
|
||||
|
||||
## Step 6: Setup Koin Modules
|
||||
## Schritt 6: Koin-Module konfigurieren
|
||||
|
||||
In `shared/src/commonMain/kotlin/di/DatabaseModule.kt`:
|
||||
|
||||
@@ -275,7 +275,7 @@ val databaseModule = module {
|
||||
|
||||
```
|
||||
|
||||
### Platform-specific modules
|
||||
### Plattformspezifische Module
|
||||
|
||||
### Android —
|
||||
|
||||
@@ -326,7 +326,7 @@ actual val platformModule = module {
|
||||
|
||||
```
|
||||
|
||||
### Common module declaration —
|
||||
### Gemeinsame Modul-Deklaration —
|
||||
|
||||
`shared/src/commonMain/kotlin/di/PlatformModule.kt`:
|
||||
|
||||
@@ -339,7 +339,7 @@ expect val platformModule: Module
|
||||
|
||||
```
|
||||
|
||||
## Step 7: Initialize Koin
|
||||
## Schritt 7: Koin initialisieren
|
||||
|
||||
In `shared/src/commonMain/kotlin/di/KoinInit.kt`:
|
||||
|
||||
@@ -359,7 +359,7 @@ fun initKoin(appDeclaration: KoinAppDeclaration = {}) = startKoin {
|
||||
|
||||
```
|
||||
|
||||
## Step 8: Platform Initialization
|
||||
## Schritt 8: Plattform-Initialisierung
|
||||
|
||||
### Android —
|
||||
|
||||
@@ -423,9 +423,9 @@ fun main() {
|
||||
|
||||
```
|
||||
|
||||
## Step 9: Use in Compose
|
||||
## Schritt 9: In Compose verwenden
|
||||
|
||||
### Create VieModel —
|
||||
### ViewModel erstellen —
|
||||
|
||||
In `shared/src/commonMain/kotlin/viewmodel/UserViewModel.kt`:
|
||||
|
||||
@@ -478,7 +478,7 @@ class UserViewModel(private val userRepository: UserRepository) : ViewModel() {
|
||||
|
||||
```
|
||||
|
||||
Use in Compose Screen:
|
||||
Im Compose-Screen verwenden:
|
||||
|
||||
```kotlin
|
||||
@Composable
|
||||
@@ -509,21 +509,20 @@ fun UserItem(user: User, onDelete: () -> Unit) {
|
||||
)
|
||||
|
||||
Button(onClick = onDelete) {
|
||||
Text("Delete")
|
||||
Text("Löschen")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### That’s It!
|
||||
### Fertig!
|
||||
|
||||
You now have SQLDelight fully integrated in your Compose Multiplatform project with:
|
||||
SQLDelight ist nun vollständig in das Compose Multiplatform-Projekt integriert mit:
|
||||
|
||||
- Database working on Android, iOS, and Desktop
|
||||
- Koin dependency injection setup
|
||||
- Repository pattern for clean architecture
|
||||
- Ready-to-use User table with CRUD operations
|
||||
- Datenbankbetrieb auf Android, iOS und Desktop
|
||||
- Koin Dependency Injection konfiguriert
|
||||
- Repository-Pattern für Clean Architecture
|
||||
- Einsatzbereite User-Tabelle mit CRUD-Operationen
|
||||
|
||||
The database will automatically handle platform-specific implementations while sharing the same business logic across
|
||||
all platforms.
|
||||
Die Datenbank verwaltet automatisch die plattformspezifischen Implementierungen, während dieselbe Geschäftslogik auf allen Plattformen geteilt wird.
|
||||
|
||||
Reference in New Issue
Block a user