Documentation
¶
Overview ¶
Package migrator provides import/export functionality. It defines Importer and Exporter interfaces amd implements for disqus (importer only) and "native" remark (both importer and exporter). Also implements AutoBackup scheduler running exports as backups and saving them locally.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImportComments ¶
func ImportComments(p ImportParams) (int, error)
ImportComments imports from given provider format and saves to store
Types ¶
type AutoBackup ¶
type AutoBackup struct { Exporter Exporter BackupLocation string SiteID string KeepMax int Duration time.Duration }
AutoBackup struct handles daily backups params for siteID
func (AutoBackup) Do ¶
func (ab AutoBackup) Do(ctx context.Context)
Do runs daily export to local files, keeps up to keepMax backups for given siteID
type Exporter ¶
Exporter defines interface to export comments from internal store
type ImportParams ¶
ImportParams defines everything needed to run import
type Importer ¶
Importer defines interface to convert posts from external sources
type Native ¶
type Native struct {
DataStore Store
}
Native implements exporter and importer for internal store format {"version": 1, comments:[{...}\n,{}], meta: {meta}} each comments starts from the new line
func (*Native) Export ¶
Export all comments to writer as json strings. Each comment is one string, separated by "\n" The final file is a valid json
type Store ¶
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 Metas(siteID string) (umetas []service.UserMetaData, pmetas []service.PostMetaData, err error) SetMetas(siteID string, umetas []service.UserMetaData, pmetas []service.PostMetaData) error }
Store defines minimal interface needed to export and import comments
Source Files
¶
- backup.go
- disqus.go
- migrator.go
- native.go
- wordpress.go