Documentation ¶
Index ¶
- Constants
- func BookFieldVisible(aFieldname string) (bool, error)
- func CalibreCachePath() string
- func CalibreLibraryPath() string
- func CalibrePreferencesFile() string
- func Init()
- func MetaFieldValue(aSection, aField string) (interface{}, error)
- func SQLtraceFile() string
- func SetCalibreCachePath(aPath string) error
- func SetCalibreLibraryPath(aPath string) error
- func SetSQLtraceFile(aFilename string)
- func VirtLibOptions(aSelected string) string
- type TCustomColumn
- type TCustomColumnList
- type TDataBase
- func (db *TDataBase) Close()
- func (db *TDataBase) QueryBy(aContext context.Context, aOptions *TQueryOptions) (rCount int, rList *TDocList, rErr error)
- func (db *TDataBase) QueryCustomColumns(aContext context.Context) (*TCustomColumnList, error)
- func (db *TDataBase) QueryDocMini(aContext context.Context, aID TID) (rDoc *TDocument)
- func (db *TDataBase) QueryDocument(aContext context.Context, aID TID) *TDocument
- func (db *TDataBase) QueryIDs(aContext context.Context) (rList *TDocList, rErr error)
- func (db *TDataBase) QuerySearch(aContext context.Context, aOptions *TQueryOptions) (rCount int, rList *TDocList, rErr error)
- type TDocList
- type TDocument
- func (doc *TDocument) AuthorList() string
- func (doc *TDocument) Authors() *TEntityList
- func (doc *TDocument) Comment() template.HTML
- func (doc *TDocument) Cover() string
- func (doc *TDocument) CoverAbs(aRelative bool) (string, error)
- func (doc *TDocument) CoverFile() (string, error)
- func (doc *TDocument) DocLink() string
- func (doc *TDocument) Filename(aFormat string) string
- func (doc *TDocument) Files() *TEntityList
- func (doc *TDocument) Formats() *TEntityList
- func (doc *TDocument) Identifiers() *TEntityList
- func (doc *TDocument) Languages() *TEntityList
- func (doc *TDocument) LastModified() string
- func (doc *TDocument) PubDate() string
- func (doc *TDocument) Publisher() *TEntity
- func (doc *TDocument) Series() *TEntity
- func (doc *TDocument) SeriesIndex() string
- func (doc *TDocument) SetPath(aPath string)
- func (doc *TDocument) Tags() *TEntityList
- func (doc *TDocument) Thumb() string
- func (doc *TDocument) Timestamp() string
- type TEntity
- type TEntityList
- type TID
- type TQueryOptions
- func (qo *TQueryOptions) DecLimit() *TQueryOptions
- func (qo *TQueryOptions) IncLimit() *TQueryOptions
- func (qo *TQueryOptions) Scan(aString string) *TQueryOptions
- func (qo *TQueryOptions) SelectLanguageOptions() *TStringMap
- func (qo *TQueryOptions) SelectLayoutOptions() *TStringMap
- func (qo *TQueryOptions) SelectLimitOptions() string
- func (qo *TQueryOptions) SelectOrderOptions() *TStringMap
- func (qo *TQueryOptions) SelectSortByOptions() *TStringMap
- func (qo *TQueryOptions) SelectThemeOptions() *TStringMap
- func (qo *TQueryOptions) SelectVirtLibOptions() string
- func (qo *TQueryOptions) String() string
- func (qo *TQueryOptions) Update(aRequest *http.Request) *TQueryOptions
- type TSearch
- type TSortType
- type TStringMap
- type TVirtLibList
Constants ¶
const ( QoLangGerman = uint8(0) QoLangEnglish = uint8(1) )
Definition of the GUI language to use
const ( QoLayoutList = uint8(0) QoLayoutGrid = uint8(1) )
Definition of the layout type
const ( QoThemeLight = uint8(0) QoThemeDark = uint8(1) )
Definition of the CSS theme to use
Variables ¶
This section is empty.
Functions ¶
func BookFieldVisible ¶
BookFieldVisible returns whether `aFieldname` should be visible or not.
If `aFieldname` can't be found the function returns `true` and an error, otherwise the (boolean) `visible` value and `nil`.
`aFieldname` The name of the field/column to check.
func CalibreCachePath ¶
func CalibreCachePath() string
CalibreCachePath returns the directory of the copied `Calibre` database.
func CalibreLibraryPath ¶
func CalibreLibraryPath() string
CalibreLibraryPath returns the base directory of the `Calibre` library.
func CalibrePreferencesFile ¶
func CalibrePreferencesFile() string
CalibrePreferencesFile returns the complete path-/filename of the `Calibre` library's preferences file.
func Init ¶
func Init()
Init instantiates the database object.
This function should be called before using the database.
func MetaFieldValue ¶
MetaFieldValue returns the value of `aField` of `aSection`.
`aSection` Name of the field's metadata section. `aField` Name of the data field within `aSection`.
func SQLtraceFile ¶
func SQLtraceFile() string
SQLtraceFile returns the filename used for the optional logging of SQL queries.
func SetCalibreCachePath ¶
SetCalibreCachePath sets the directory of the `Calibre` database copy.
If `aPath` is an empty string or is a directory that can't be used or created the function returns an appropriate error, otherwise the return value is `nil`.
`aPath` is the directory path to use for caching the `Calibre` library.
func SetCalibreLibraryPath ¶
SetCalibreLibraryPath sets the base directory of the `Calibre` library.
If `aPath` is an empty string or is a directory that can't be used the function returns an appropriate error, otherwise the return value is `nil`.
`aPath` is the directory path where the `Calibre` library resides.
func SetSQLtraceFile ¶
func SetSQLtraceFile(aFilename string)
SetSQLtraceFile sets the filename to use for logging SQL queries.
If the provided `aFilename` is empty the SQL logging gets disabled.
NOTE: Once the function was called with a valid `aFilename` argument any forther call will be ignored.
`aFilename` The tracefile to use, if empty tracing is disabled.
func VirtLibOptions ¶
VirtLibOptions returns the SELECT/OPTIONs of the virtual libraries.
`aSelected` Name of the currently selected library.
Types ¶
type TCustomColumn ¶
TCustomColumn contains info about a user-defined data field.
The member fields should be considered R/O.
type TCustomColumnList ¶
type TCustomColumnList []TCustomColumn
TCustomColumnList is a list of `TCustomColumn` instances.
type TDataBase ¶
type TDataBase struct {
// contains filtered or unexported fields
}
TDataBase An opaque structure providing the properties and methods to access the `Calibre` database.
func OpenDatabase ¶
OpenDatabase returns a database connection.
`aContext` The current web request's context.
func (*TDataBase) Close ¶
func (db *TDataBase) Close()
Close terminates the current database connection.
func (*TDataBase) QueryBy ¶
func (db *TDataBase) QueryBy(aContext context.Context, aOptions *TQueryOptions) (rCount int, rList *TDocList, rErr error)
QueryBy returns all documents according to `aOptions`.
The method returns in `rCount` the number of documents found, in `rList` either `nil` or a list list of documents, in `rErr` either `nil` or the error occurred during the search.
`aContext` The current web request's context. `aOptions` The options to configure the query.
func (*TDataBase) QueryCustomColumns ¶
func (db *TDataBase) QueryCustomColumns(aContext context.Context) (*TCustomColumnList, error)
QueryCustomColumns returns data about user-defined columns in `Calibre`.
`aContext` The current web request's context.
func (*TDataBase) QueryDocMini ¶
QueryDocMini returns the document identified by `aID`.
This function fills only the document properties `ID`, `formats`, `path`, and `Title`. If a matching document could not be found the function returns `nil`.
`aContext` The current web request's context. `aID` The document ID to lookup.
func (*TDataBase) QueryDocument ¶
QueryDocument returns the `TDocument` identified by `aID`.
In case the document with `aID` can not be found the function returns `nil`.
`aContext` The current web request's context. `aID` The document ID to lookup.
func (*TDataBase) QueryIDs ¶
QueryIDs returns a list of documents with only the `ID` and `path` fields set.
This method is used by `thumbnails`.
`aContext` The current web request's context.
func (*TDataBase) QuerySearch ¶
func (db *TDataBase) QuerySearch(aContext context.Context, aOptions *TQueryOptions) (rCount int, rList *TDocList, rErr error)
QuerySearch returns a list of documents matching the criteria in `aOptions`.
The function returns in `rCount` the number of documents found, in `rList` either `nil` or a list list of documents, in `rErr` either `nil` or an error occurred during the search.
`aContext` The current request's context. `aOptions` The options to configure the query.
type TDocument ¶
type TDocument struct { ID TID ISBN string Pages int Rating int Size int64 Title string // contains filtered or unexported fields }
TDocument represents a single document (e.g. book)
func (*TDocument) AuthorList ¶
AuthorList returns a CSV list of the document's author(s).
func (*TDocument) Authors ¶
func (doc *TDocument) Authors() *TEntityList
Authors returns a list of ID/Name/URL author fields.
func (*TDocument) CoverAbs ¶
CoverAbs returns the path/filename of the document's cover image.
If `aRelative` is `true` the function result is the path/filename relative to `CalibreLibraryPath()`, otherwise it's the document cover's complete path/filename.
`aRelative` Flag indicating a complete or relative path/filename
of the document's cover.
func (*TDocument) CoverFile ¶
CoverFile returns the complete path/filename of the document's cover file.
func (*TDocument) Files ¶
func (doc *TDocument) Files() *TEntityList
Files returns a list of ID/Name/URL fields for doc format files.
func (*TDocument) Formats ¶
func (doc *TDocument) Formats() *TEntityList
Formats returns a list of ID/Name/URL fields for doc formats.
func (*TDocument) Identifiers ¶
func (doc *TDocument) Identifiers() *TEntityList
Identifiers returns a list of ID/Name/URL identifier fields.
func (*TDocument) Languages ¶
func (doc *TDocument) Languages() *TEntityList
Languages returns an ID/Name/URL language struct.
func (*TDocument) LastModified ¶
LastModified returns the last-modified date/time of the document.
func (*TDocument) SeriesIndex ¶
SeriesIndex returns the document's series index as formatted string.
func (*TDocument) Tags ¶
func (doc *TDocument) Tags() *TEntityList
Tags returns a list of ID/Name/URL tag fields.
type TEntity ¶
type TEntity struct { ID TID // database row ID Name string // name of the column/field URL string // local URL to access this entity }
TEntity is a basic entity structure.
type TQueryOptions ¶
type TQueryOptions struct { ID TID // an entity ID to lookup Descending bool // sort direction Entity string // query for a certain entity (authors, publisher, series, tags) GuiLang uint8 // GUI language Layout uint8 // either `qoLayoutList` or `qoLayoutGrid` LimitLength uint // number of documents per page LimitStart uint // starting number Matching string // text to lookup in all documents QueryCount uint // number of DB records matching the query options SortBy TSortType // display order of documents (`qoSortByXXX`) Theme uint8 // CSS presentation theme VirtLib string // virtual libraries }
TQueryOptions hold properties configuring a query.
This type is used by the HTTP pagehandler when receiving a page request.
func NewQueryOptions ¶
func NewQueryOptions(aDocsPerPage int) *TQueryOptions
NewQueryOptions returns a new `TQueryOptions` instance.
`aDocsPerPage` The number of documents per page to show.
func (*TQueryOptions) DecLimit ¶
func (qo *TQueryOptions) DecLimit() *TQueryOptions
DecLimit decrements the LIMIT-start value.
func (*TQueryOptions) IncLimit ¶
func (qo *TQueryOptions) IncLimit() *TQueryOptions
IncLimit increments the LIMIT values.
func (*TQueryOptions) Scan ¶
func (qo *TQueryOptions) Scan(aString string) *TQueryOptions
Scan returns the options read from `aString`.
`aString` The value string to scan.
func (*TQueryOptions) SelectLanguageOptions ¶
func (qo *TQueryOptions) SelectLanguageOptions() *TStringMap
SelectLanguageOptions returns a list of two SELECT/OPTIONs for the language choice.
func (*TQueryOptions) SelectLayoutOptions ¶
func (qo *TQueryOptions) SelectLayoutOptions() *TStringMap
SelectLayoutOptions returns a list of SELECT/OPTIONs for the layout choice.
func (*TQueryOptions) SelectLimitOptions ¶
func (qo *TQueryOptions) SelectLimitOptions() string
SelectLimitOptions returns a list of SELECT/OPTIONs for the limit (documents per page) choice.
func (*TQueryOptions) SelectOrderOptions ¶
func (qo *TQueryOptions) SelectOrderOptions() *TStringMap
SelectOrderOptions returns a list of SELECT/OPTIONs for the order choice.
func (*TQueryOptions) SelectSortByOptions ¶
func (qo *TQueryOptions) SelectSortByOptions() *TStringMap
SelectSortByOptions returns a list of SELECT/OPTIONs for the order choice.
func (*TQueryOptions) SelectThemeOptions ¶
func (qo *TQueryOptions) SelectThemeOptions() *TStringMap
SelectThemeOptions returns a list of SELECT/OPTIONs for the theme choice.
func (*TQueryOptions) SelectVirtLibOptions ¶
func (qo *TQueryOptions) SelectVirtLibOptions() string
SelectVirtLibOptions returns a list of SELECT/OPTIONs for the virtual library choice.
func (*TQueryOptions) String ¶
func (qo *TQueryOptions) String() string
String returns the options as a `|` delimited string.
func (*TQueryOptions) Update ¶
func (qo *TQueryOptions) Update(aRequest *http.Request) *TQueryOptions
Update returns a `TQueryOptions` instance with updated values read from the `aRequest` data.
`aRequest` The current HTTP request.
type TSearch ¶
type TSearch struct {
// contains filtered or unexported fields
}
TSearch provides text search capabilities.
type TStringMap ¶
TStringMap is a map of strings indexed by string.
type TVirtLibList ¶
TVirtLibList is the `virtual_libraries` JSON metadata section indexed by virt.library name.
func VirtualLibraryList ¶
func VirtualLibraryList() (TVirtLibList, error)
VirtualLibraryList returns a list of virtual library definitions and SQL code to access them.