/
archaron
/
go-yubiserv
Обзор
Документация
Войти
/
archaron
/
go-yubiserv
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
modules/sqlitestorage/module.go
50 строк
1 KB
Alexander Tischenko
chore: refactoring / tests
04 мар 2026, 20:12
Не верифицирован
04 мар 2026, 20:12
519fe11
Код
Авторство
О чём код?
// Package sqlitestorage represents SQLite database keys storage. package sqlitestorage import ( "github.com/im-kulikov/helium/module" "github.com/jmoiron/sqlx" "go.uber.org/zap" ) // Module storage constructor. var Module = module.Module{ //nolint:gochecknoglobals {Constructor: newService}, } // TestNewService creates a new service for testing purposes. func TestNewService(log *zap.Logger, getterFunc KeyGetterFunc, db *sqlx.DB) *Service { svc := &Service{log: log, getKeyFunc: getterFunc, db: db} if getterFunc == nil { svc.getKeyFunc = svc.GetKey } return svc } // TestNewServicePath creates a new service for testing purposes with database path. func TestNewServicePath(log *zap.Logger, getterFunc KeyGetterFunc, dbPath string) *Service { svc := &Service{log: log, getKeyFunc: getterFunc, dbPath: dbPath} if getterFunc == nil { svc.getKeyFunc = svc.GetKey } return svc } func newService(p serviceParams) serviceOutParams { svc := &Service{ log: p.Logger, dbPath: p.Config.GetString("sqlite.dbpath"), } // Default key fetcher svc.getKeyFunc = svc.GetKey return serviceOutParams{ Service: svc, Storage: svc, } }