split db and bolt to store interface

This commit is contained in:
ston1th 2018-09-11 14:50:53 +02:00
commit 7e77fd7d27
14 changed files with 419 additions and 545 deletions

37
pkg/store/store.go Normal file
View file

@ -0,0 +1,37 @@
// Copyright (C) 2018 Marius Schellenberger
package store
import (
"fmt"
)
//const (
// dbFile = "gowiki.db"
// defUser = "admin"
// defPassword = "gowiki"
// userTable = "user"
// pageTable = "page"
// snippetTable = "snippet"
// bcryptCost = 13
// indexName = "Index"
// welcome = `# Welcome to GoWiki
//This is the [Index](/wiki/Index) page.
//You can customize it how you like.`
// wikiSection = "wiki"
//)
func storeErr(i interface{}) error {
return fmt.Errorf("store: %s", i)
}
var ErrKeyNotFound = storeErr("key not found")
type Store interface {
Marshaler
Get(string, interface{}) error
Set(string, interface{}) error
ForEach(func(string, []byte) error) error
Delete(string) error
Close() error
}