github.com/shoshinnikita/budget-manager@v0.7.1-0.20220131195411-8c46ff1c6778/internal/db/sqlite/sqlite.go (about) 1 package sqlite 2 3 //nolint:gci 4 import ( 5 _ "github.com/mattn/go-sqlite3" // register SQLite driver 6 7 "github.com/ShoshinNikita/budget-manager/internal/db/base" 8 "github.com/ShoshinNikita/budget-manager/internal/db/sqlite/migrations" 9 "github.com/ShoshinNikita/budget-manager/internal/logger" 10 ) 11 12 type DB struct { 13 *base.DB 14 } 15 16 type Config struct { 17 Path string 18 } 19 20 func NewDB(config Config, log logger.Logger) (*DB, error) { 21 db, err := base.NewDB("sqlite3", config.Path, base.Question, migrations.GetMigrations(), log) 22 if err != nil { 23 return nil, err 24 } 25 return &DB{db}, nil 26 }