restrict import/export to minimal store interface

This commit is contained in:
Umputun
2018-05-30 13:57:26 -05:00
parent 5676ba9a0e
commit 7d062e618c
3 changed files with 12 additions and 8 deletions
+1 -2
View File
@@ -10,12 +10,11 @@ import (
"github.com/pkg/errors"
"github.com/umputun/remark/app/store"
"github.com/umputun/remark/app/store/service"
)
// Disqus implements Importer from disqus xml
type Disqus struct {
DataStore *service.DataStore
DataStore Store
}
type disqusThread struct {
+10 -3
View File
@@ -9,8 +9,7 @@ import (
"os"
"github.com/pkg/errors"
"github.com/umputun/remark/app/store/service"
"github.com/umputun/remark/app/store"
)
// Importer defines interface to convert posts from external sources
@@ -23,9 +22,17 @@ type Exporter interface {
Export(w io.Writer, siteID string) (int, error)
}
// Store defines minimal interface needed to export and import comments
type Store interface {
Create(comment store.Comment) (commentID string, err error)
Find(locator store.Locator, sort string) ([]store.Comment, error)
List(siteID string, limit int, skip int) ([]store.PostInfo, error)
DeleteAll(siteID string) error
}
// ImportParams defines everything needed to run import
type ImportParams struct {
DataStore *service.DataStore
DataStore Store
InputFile string
Provider string
SiteID string
+1 -3
View File
@@ -8,14 +8,12 @@ import (
"log"
"github.com/pkg/errors"
"github.com/umputun/remark/app/store/service"
"github.com/umputun/remark/app/store"
)
// Remark implements exporter and importer for internal store format
type Remark struct {
DataStore *service.DataStore
DataStore Store
}
// Export all comments to writer as json strings. Each comment is one string, separated by "\n"