feat: add SQL/SQLite, AppSec, Capstone incident-tracker, Gitea Actions CI and spaced repetition
Test and Lint / quality (push) Successful in 2m13s
Test and Lint / quality (push) Successful in 2m13s
This commit is contained in:
1 parent
011f23e637
commit
33082598fc
19 files changed
+496
-6
No files matched your search
@@ -0,0 +1,14 @@
|
||||
# 05 — SQL i SQLite (`database/sql` + `modernc.org/sqlite`, ochrona przed SQLi)
|
||||
|
||||
Teoria: [notes/06-sql-and-databases.md](../../../notes/06-sql-and-databases.md)
|
||||
|
||||
## Zadania (`sqlite_store.go`)
|
||||
Zaimplementuj `ServiceRegistry` na `database/sql` ze sterownikiem pure-Go `modernc.org/sqlite` (`sql.Open("sqlite", dbPath)`):
|
||||
1. `InitSchema() error` — `CREATE TABLE IF NOT EXISTS services(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, owner TEXT NOT NULL)`.
|
||||
2. `Register(name, owner string) (int64, error)` — parametryzowany `INSERT` (`?`) i `res.LastInsertId()`.
|
||||
3. `FindByOwner(owner string) ([]string, error)` — posortowana lista nazw serwisów bez podatności na SQL Injection.
|
||||
|
||||
## Uruchomienie testów
|
||||
```bash
|
||||
make test PKG=./exercises/03-ecosystems/05-sql-sqlite
|
||||
```
|
||||
Reference in new issue
Block a user