Documentation ¶
Overview ¶
Package database implements a wrapper around the real database with some helper functions to store catalog / log entries
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CatalogEntry ¶
type CatalogEntry struct { Name string `json:"name" yaml:"name"` Tag string `json:"tag" yaml:"tag"` Fetcher string `json:"-" yaml:"fetcher"` FetcherConfig *fieldcollection.FieldCollection `json:"-" yaml:"fetcher_config"` VersionConstraint *version.Constraint `json:"-" yaml:"version_constraint"` Links []CatalogLink `json:"links" yaml:"links"` }
CatalogEntry represents the entry in the config file
func (CatalogEntry) Key ¶
func (c CatalogEntry) Key() string
Key returns the name / tag combination as a single key
type CatalogLink ¶
type CatalogLink struct { IconClass string `json:"icon_class" yaml:"icon_class"` Name string `json:"name" yaml:"name"` URL string `json:"url" yaml:"url"` }
CatalogLink represents a link assigned to a CatalogEntry
type CatalogMeta ¶
type CatalogMeta struct { CatalogName string `gorm:"primaryKey" json:"-"` CatalogTag string `gorm:"primaryKey" json:"-"` CurrentVersion string `json:"current_version,omitempty"` Error string `json:"error,omitempty"` LastChecked *time.Time `json:"last_checked,omitempty"` VersionTime *time.Time `json:"version_time,omitempty"` }
CatalogMeta contains meta-information about the catalog entry
type CatalogMetaStore ¶
type CatalogMetaStore struct {
// contains filtered or unexported fields
}
CatalogMetaStore is an accessor for the meta store and wraps a Client
func (CatalogMetaStore) GetMeta ¶
func (c CatalogMetaStore) GetMeta(ce *CatalogEntry) (*CatalogMeta, error)
GetMeta fetches the current database stored CatalogMeta for the CatalogEntry
func (CatalogMetaStore) Migrate ¶ added in v0.3.0
func (c CatalogMetaStore) Migrate(dest *Client) error
Migrate applies the updated database schema for the CatalogMetaStore
func (CatalogMetaStore) PutMeta ¶
func (c CatalogMetaStore) PutMeta(cm *CatalogMeta) error
PutMeta stores the updated CatalogMeta
type Client ¶
type Client struct { Catalog CatalogMetaStore Logs LogStore // contains filtered or unexported fields }
Client represents a database client
type LogEntry ¶
type LogEntry struct { CatalogName string `gorm:"index:catalog_key" json:"catalog_name"` CatalogTag string `gorm:"index:catalog_key" json:"catalog_tag"` Timestamp time.Time `gorm:"index:,sort:desc" json:"timestamp"` VersionTo string `json:"version_to"` VersionFrom string `json:"version_from"` }
LogEntry represents a single version change for a given catalog entry
type LogStore ¶
type LogStore struct {
// contains filtered or unexported fields
}
LogStore is an accessor for the log store and wraps a Client
func (LogStore) ListForCatalogEntry ¶
func (l LogStore) ListForCatalogEntry(ce *CatalogEntry, num, page int) ([]LogEntry, error)
ListForCatalogEntry retrieves filered log entries by page