1
0

Oh, replaced SQLiteMindflow with Mindflow interface.

This commit is contained in:
Alexander Andreev 2023-05-14 03:38:17 +04:00
parent 8cbd8f143f
commit f12ce11b7f
Signed by: Arav
GPG Key ID: D22A817D95815393
2 changed files with 4 additions and 5 deletions

View File

@ -9,7 +9,6 @@ import (
"time" "time"
"git.arav.su/Arav/dwelling-home/pkg/mindflow" "git.arav.su/Arav/dwelling-home/pkg/mindflow"
"git.arav.su/Arav/dwelling-home/pkg/mindflow/database/sqlite"
"git.arav.su/Arav/justcaptcha/pkg/captcha" "git.arav.su/Arav/justcaptcha/pkg/captcha"
"git.arav.su/Arav/justcaptcha/pkg/captcha/inmemdb" "git.arav.su/Arav/justcaptcha/pkg/captcha/inmemdb"
"git.arav.su/Arav/justcaptcha/pkg/dwcaptcha" "git.arav.su/Arav/justcaptcha/pkg/dwcaptcha"
@ -214,10 +213,10 @@ func (h *CaptchaApiHandlers) Image(w http.ResponseWriter, r *http.Request) {
// Mindflow API //////////////////////////////////////////////////////////////// // Mindflow API ////////////////////////////////////////////////////////////////
type MindflowApiHandlers struct { type MindflowApiHandlers struct {
db *sqlite.SQLiteMindflow db mindflow.Mindflow
} }
func NewMindflowApiHandlers(db *sqlite.SQLiteMindflow) *MindflowApiHandlers { func NewMindflowApiHandlers(db mindflow.Mindflow) *MindflowApiHandlers {
return &MindflowApiHandlers{db: db} return &MindflowApiHandlers{db: db}
} }

View File

@ -82,7 +82,7 @@ type SQLiteMindflow struct {
db *sql.DB db *sql.DB
} }
func NewSQLiteMindflow(path string) (*SQLiteMindflow, error) { func NewSQLiteMindflow(path string) (mindflow.Mindflow, error) {
db, err := sql.Open("sqlite3", dsn(path)) db, err := sql.Open("sqlite3", dsn(path))
if err != nil { if err != nil {
return nil, err return nil, err
@ -121,7 +121,7 @@ func (s *SQLiteMindflow) New(post *mindflow.Post) error {
return nil return nil
} }
func (s *SQLiteMindflow) Edit(post mindflow.Post) error { func (s *SQLiteMindflow) Edit(post *mindflow.Post) error {
tx, err := s.db.Begin() tx, err := s.db.Begin()
if err != nil { if err != nil {
return err return err