restrict import/export to minimal store interface
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user