gomobile

package
v0.0.0-...-0f3d56e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CatalogExists

func CatalogExists(path string) bool

CatalogExists checks if catalog.db exists at path

func CatalogNeedsUpdate

func CatalogNeedsUpdate(path string) bool

CatalogNeedsUpdate checks if catalog.db located at path is still up-to-date. For now it just makes sure that it is younger than one month. If it can't find a file at path, it returns true

func CatalogSize

func CatalogSize(path string) int64

CatalogSize returns the size of the catalog.db at path

func LookupPublication

func LookupPublication(dbPath string, query *PublicationLookup) string

LookupPublication looks up a publication from catalogDB located at dbPath and returns a JSON string representing the Publication

Types

type DatabaseStats

type DatabaseStats struct {
	BlockRange int
	Bookmark   int
	InputField int
	Location   int
	Note       int
	Tag        int
	TagMap     int
	UserMark   int
}

DatabaseStats represents the rough number of entries within a Database{} by defining it as the length of the slices.

type DatabaseWrapper

type DatabaseWrapper struct {
	// contains filtered or unexported fields
}

DatabaseWrapper wraps the left, right, and merged Database structs so they can be used with Gomobile.

func (*DatabaseWrapper) DBContainsPlaylists

func (dbw *DatabaseWrapper) DBContainsPlaylists(side string) bool

DBContainsPlaylists indicates if a DB on the given side contains playlists.

func (*DatabaseWrapper) DBIsLoaded

func (dbw *DatabaseWrapper) DBIsLoaded(side string) bool

DBIsLoaded indicates if a DB on the given side has been loaded.

func (*DatabaseWrapper) ExportMerged

func (dbw *DatabaseWrapper) ExportMerged(filename string) error

ExportMerged exports the merged database to filename.

func (*DatabaseWrapper) ImportJWLBackup

func (dbw *DatabaseWrapper) ImportJWLBackup(filename string, side string) error

ImportJWLBackup imports a .jwlibrary backup file into the struct on the given side.

func (*DatabaseWrapper) Init

func (dbw *DatabaseWrapper) Init()

Init initializes the DatabaseWrapper to prepare for subsequent function calls. Should be called after ImportJWLBackup.

func (*DatabaseWrapper) MergeBookmarks

func (dbw *DatabaseWrapper) MergeBookmarks(conflictSolver string, mcw *MergeConflictsWrapper) error

MergeBookmarks merges bookmarks

func (*DatabaseWrapper) MergeInputFields

func (dbw *DatabaseWrapper) MergeInputFields(conflictSolver string, mcw *MergeConflictsWrapper) error

MergeInputField merges inputFields

func (*DatabaseWrapper) MergeLocations

func (dbw *DatabaseWrapper) MergeLocations() error

MergeLocations merges locations

func (*DatabaseWrapper) MergeNotes

func (dbw *DatabaseWrapper) MergeNotes(conflictSolver string, mcw *MergeConflictsWrapper) error

MergeNotes merges notes

func (*DatabaseWrapper) MergeTagMaps

func (dbw *DatabaseWrapper) MergeTagMaps() error

MergeTagMaps merges tagMaps

func (*DatabaseWrapper) MergeTags

func (dbw *DatabaseWrapper) MergeTags() error

MergeTags merges tags

func (*DatabaseWrapper) MergeUserMarkAndBlockRange

func (dbw *DatabaseWrapper) MergeUserMarkAndBlockRange(conflictSolver string, mcw *MergeConflictsWrapper) error

MergeUserMarkAndBlockRange merges UserMarks and BlockRanges

func (*DatabaseWrapper) SkipPlaylists

func (dbw *DatabaseWrapper) SkipPlaylists(skipPlaylists bool)

SkipPlaylists allows to skip the check if playlists exist in the database. It is meant as a temporary workaround until merging of playlists is implemented.

func (*DatabaseWrapper) Stats

func (dbw *DatabaseWrapper) Stats(side string) *DatabaseStats

Stats generates a DatabaseStats for the given mergeSide

type DownloadManager

type DownloadManager struct {
	Progress *DownloadProgress
	// contains filtered or unexported fields
}

DownloadManager keeps all the information of a running download, enabling it to check progress and also cancel the download if necessary

func DownloadCatalog

func DownloadCatalog(dst string) *DownloadManager

DownloadCatalog downloads the newest catalog.db and saves it at dst. The returned DownloadManager allows to keep track and manage the running download

func (*DownloadManager) CancelDownload

func (dm *DownloadManager) CancelDownload()

CancelDownload cancels a running download

func (*DownloadManager) DownloadSuccessful

func (dm *DownloadManager) DownloadSuccessful() bool

DownloadSuccessful indicates if the download has been successful

func (*DownloadManager) Error

func (dm *DownloadManager) Error() string

Error returns possible errors of a download as a string

type DownloadProgress

type DownloadProgress struct {
	Size           int64
	BytesComplete  int64
	BytesPerSecond float64
	Progress       float64
	Done           bool
	Canceled       bool
}

DownloadProgress represents the progress of a running download

type MergeConflict

type MergeConflict struct {
	Key   string
	Left  string
	Right string
}

MergeConflict represents two Models that collide. It is equvalent to merger.MergeConflict, but represents the Models as strings to make it compatible with Gomobile.

type MergeConflictError

type MergeConflictError struct {
	Err string
}

MergeConflictError indicates that a conflict happened while merging. It is equivalent to merger.MergeConflictError, but does not contain the actual conflicts to make it compatible with Gomobile.

func (MergeConflictError) Error

func (e MergeConflictError) Error() string

type MergeConflictsWrapper

type MergeConflictsWrapper struct {
	DBWrapper *DatabaseWrapper
	// contains filtered or unexported fields
}

MergeConflictsWrapper wraps mergeConflicts and their solutions

func (*MergeConflictsWrapper) InitDBWrapper

func (mcw *MergeConflictsWrapper) InitDBWrapper(dbw *DatabaseWrapper)

InitDBWrapper initializes the DatabaseWrapper for the MergeConflictsWrapper so the DB is accessible for pretty printing.

func (*MergeConflictsWrapper) NextConflict

func (mcw *MergeConflictsWrapper) NextConflict() (*MergeConflict, error)

NextConflict returns the next conflict that should be solved. If there are no left, it returns an error

func (*MergeConflictsWrapper) SolveConflict

func (mcw *MergeConflictsWrapper) SolveConflict(key string, side string) error

SolveConflict solves a mergeConflict represented by key and chooses the given side

type PublicationLookup

type PublicationLookup struct {
	DocumentID     int
	KeySymbol      string
	IssueTagNumber int
	MepsLanguage   int
}

PublicationLookup represents a lookup for a publication. It directly maps to publication.Lookup

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL