Documentation ¶
Index ¶
Constants ¶
View Source
const ( SearchFieldName = SearchField("name") SearchFieldFavorite = SearchField("favorite") SearchFieldTag = SearchField("tag") SortFieldName = SortField("name") SortFieldCreateTime = SortField("createTime") SortOrderAscending = SortOrder("ascending") SortOrderDescending = SortOrder("descending") )
View Source
const CurrentVersion = 1
CurrentVersion the current version of `Meta` structure.
Variables ¶
View Source
var BaseDirectory string
BaseDirectory the data directory
View Source
var ErrMetaDataNotFound = errors.New(2_000_000, "metadata for '%s' not found.")
Functions ¶
Types ¶
type Meta ¶
type Meta struct { Name string `json:"name" db:"name" bson:"name"` CreateTime time.Time `json:"create_time" db:"create_time" bson:"create_time"` Favorite bool `json:"favorite" db:"favorite" bson:"favorite"` FileIndices []int `json:"file_indices" bson:"file_indices"` Thumbnail []byte `json:"thumbnail" db:"thumbnail" bson:"thumbnail"` IsRead bool `json:"is_read" db:"read" bson:"is_read"` Tags []string `json:"tags" db:"tags" bson:"tags"` Version int `json:"version" db:"version" bson:"version"` }
Meta the metadata for each manga item. Do not change the field type nor names. Add new field when necessary. Also, when update the structure, if the new field is required, increment the CurrentVersion by one and create a migration function.
func (*Meta) GenerateImageIndices ¶
func (*Meta) GenerateThumbnail ¶
func (*Meta) PopulateTags ¶
func (m *Meta) PopulateTags()
type MigrateFunction ¶
type Provider ¶
type Provider interface { IsItemExist(name string) bool Write(i Meta) error Delete(i Meta) error Read(name string) (i Meta, err error) Open(name string) (i Meta, err error) ReadAll() (items []Meta, err error) Search(criteria []SearchCriteria, sort SortField, order SortOrder, pageSize int, page int) (items []Meta, err error) Count(criteria []SearchCriteria) (count int64, err error) Close() error }
Provider meta data provider.
type ProviderFactory ¶
type SearchCriteria ¶
type SearchCriteria struct { Field SearchField Value interface{} }
type SearchField ¶
type SearchField string
Click to show internal directories.
Click to hide internal directories.