1
0

Instead of creating an instance get it as an argument.

This commit is contained in:
Alexander Andreev 2023-05-09 23:36:12 +04:00
parent f8a8d948a4
commit 6ce598d193
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -13,7 +13,6 @@ import (
"git.arav.su/Arav/dwelling-home/web"
"git.arav.su/Arav/justcaptcha/pkg/captcha/inmemdb"
"git.arav.su/Arav/justcaptcha/pkg/dwcaptcha"
gbsqlite "git.arav.su/Arav/justguestbook/database/sqlite"
"git.arav.su/Arav/justguestbook/guestbook"
)
@ -24,16 +23,9 @@ type Handlers struct {
guestbookPageSize int64
}
func NewHandlers(captchaExpire time.Duration, dbPath, gbOwner string, gbPageSize int64) *Handlers {
gbdb, err := gbsqlite.New(dbPath + "/guestbook.sqlite")
if err != nil {
panic(err)
}
inmemdb.SetExpiry(captchaExpire)
func NewHandlers(captchaExpire time.Duration, gbOwner string, gbPageSize int64, db guestbook.Guestbook) *Handlers {
return &Handlers{
guestbookDB: gbdb,
guestbookDB: db,
captchaExpire: captchaExpire,
guestbookOwner: gbOwner,
guestbookPageSize: gbPageSize}