combluotion/store/sqlite/repo.go

39 lines
631 B
Go
Raw Normal View History

package sqlite
import (
2024-10-28 13:48:22 -05:00
"codeberg.org/danjones000/combluotion/config"
"codeberg.org/danjones000/combluotion/store"
"github.com/go-ap/storage-sqlite"
)
func init() {
store.AddFactory("sqlite", MakeStore)
}
type settings struct {
Path string
}
func MakeStore(conf config.Store) (store.Store, error) {
var s settings
err := conf.Decode(&s)
if err != nil {
return nil, err
}
sqlConf := sqlite.Config{Path: s.Path}
db, err := sqlite.New(sqlConf)
if err != nil {
return nil, err
}
return Repo{db}, nil
}
type Repo struct {
store.PartStore
}
func (r Repo) Bootstrap(config.Config) error {
// @todo
return nil
}