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 ImportParams ¶
ImportParams defines everything needed to run import
type MapperMaker ¶
MapperMaker defines function that reads rules from reader and returns new Mapper with loaded rules. If rules are not valid it returns error.
type Native ¶
Native implements exporter and importer for internal store format {"version": 1, comments:[{...}\n,{}], meta: {meta}} each comments starts from the new line
type Store ¶
type Store interface { Create(comment store.Comment) (commentID string, err error) Find(locator store.Locator, sort string, user store.User) ([]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
type URLMapper ¶
type URLMapper struct {
// contains filtered or unexported fields
}
URLMapper implements Mapper interface