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,36 @@
|
||||
package sqlsqlite
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
_ "modernc.org/sqlite"
|
||||
)
|
||||
|
||||
type ServiceRegistry struct {
|
||||
//lint:ignore U1000 używane po zaimplementowaniu metod
|
||||
db *sql.DB
|
||||
}
|
||||
|
||||
func OpenRegistry(dbPath string) (*ServiceRegistry, error) {
|
||||
db, err := sql.Open("sqlite", dbPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ServiceRegistry{db: db}, nil
|
||||
}
|
||||
|
||||
func (r *ServiceRegistry) Close() error {
|
||||
return r.db.Close()
|
||||
}
|
||||
|
||||
func (r *ServiceRegistry) InitSchema() error {
|
||||
panic("TODO: CREATE TABLE IF NOT EXISTS services (...)")
|
||||
}
|
||||
|
||||
func (r *ServiceRegistry) Register(name, owner string) (int64, error) {
|
||||
panic("TODO: parametryzowany INSERT INTO services(name, owner) VALUES(?, ?)")
|
||||
}
|
||||
|
||||
func (r *ServiceRegistry) FindByOwner(owner string) ([]string, error) {
|
||||
panic("TODO: parametryzowany SELECT name FROM services WHERE owner = ? ORDER BY name ASC")
|
||||
}
|
||||
Reference in new issue
Block a user