Documentation ¶
Overview ¶
Package database manages storage for GoPkgDoc.
Index ¶
- Variables
- func PurgeIndex(c context.Context) error
- func PutIndex(c context.Context, pdoc *doc.Package, id string, score float64, ...) error
- type Database
- func (db *Database) AddBadCrawl(path string) error
- func (db *Database) AddNewCrawl(importPath string) error
- func (db *Database) AllPackages() ([]Package, error)
- func (db *Database) Block(root string) error
- func (db *Database) BumpCrawl(projectRoot string) error
- func (db *Database) Delete(path string) error
- func (db *Database) Do(f func(*PackageInfo) error) error
- func (db *Database) Exists(path string) (bool, error)
- func (db *Database) Get(path string) (*doc.Package, []Package, time.Time, error)
- func (db *Database) GetDoc(path string) (*doc.Package, time.Time, error)
- func (db *Database) GetGob(key string, value interface{}) error
- func (db *Database) GoIndex() ([]Package, error)
- func (db *Database) GoSubrepoIndex() ([]Package, error)
- func (db *Database) ImportGraph(pdoc *doc.Package, level DepLevel) ([]Package, [][2]int, error)
- func (db *Database) ImporterCount(path string) (int, error)
- func (db *Database) Importers(path string) ([]Package, error)
- func (db *Database) IncrementCounter(key string, delta float64) (float64, error)
- func (db *Database) IncrementPopularScore(path string) error
- func (db *Database) Index() ([]Package, error)
- func (db *Database) IsBlocked(path string) (bool, error)
- func (db *Database) Packages(paths []string) ([]Package, error)
- func (db *Database) PopNewCrawl() (string, bool, error)
- func (db *Database) Popular(count int) ([]Package, error)
- func (db *Database) PopularWithScores() ([]Package, error)
- func (db *Database) Project(projectRoot string) ([]Package, error)
- func (db *Database) Put(pdoc *doc.Package, nextCrawl time.Time, hide bool) error
- func (db *Database) PutGob(key string, value interface{}) error
- func (db *Database) Query(q string) ([]Package, error)
- func (db *Database) Reindex(ctx context.Context) error
- func (db *Database) SetNextCrawl(path string, t time.Time) error
- type DepLevel
- type Package
- type PackageInfo
Constants ¶
This section is empty.
Variables ¶
var ( RedisServer = "redis://127.0.0.1:6379" // URL of Redis server RedisIdleTimeout = 250 * time.Second // Close Redis connections after remaining idle for this duration. RedisLog = false // Log database commands GAESearch = false // Use GAE Search API in the search function. )
Configuration variables (and default values of flags.
Functions ¶
func PurgeIndex ¶
PurgeIndex deletes all the packages from the search index.
func PutIndex ¶
func PutIndex(c context.Context, pdoc *doc.Package, id string, score float64, importCount int) error
PutIndex creates or updates a package entry in the search index. id identifies the document in the index. If pdoc is non-nil, PutIndex will update the package's name, path and synopsis supplied by pdoc. pdoc must be non-nil for a package's first call to PutIndex. PutIndex updates the Score to score, if non-negative.
Types ¶
type Database ¶
func (*Database) AddBadCrawl ¶
func (*Database) AddNewCrawl ¶
func (*Database) AllPackages ¶
func (*Database) Do ¶
func (db *Database) Do(f func(*PackageInfo) error) error
Do executes function f for each document in the database.
func (*Database) Get ¶
Get gets the package documentation and sub-directories for the the given import path.
func (*Database) GoSubrepoIndex ¶
func (*Database) ImportGraph ¶
func (*Database) IncrementCounter ¶
func (*Database) IncrementPopularScore ¶
func (*Database) PopularWithScores ¶
type DepLevel ¶
type DepLevel int
DepLevel specifies the level of depdenencies to show in an import graph.
type Package ¶
type Package struct { Name string `json:"name,omitempty"` Path string `json:"path"` ImportCount int `json:"import_count` Synopsis string `json:"synopsis,omitempty"` Fork bool `json:"fork,omitempty"` Stars int `json:"stars,omitempty"` Score float64 `json:"score,omitempty"` }
Package represents the content of a package both for the search index and for the HTML template. It implements the search.FieldLoadSaver interface to customize the Rank function in the search index.
func Search ¶
Search searches the packages index for a given query. A path-like query string will be passed in unchanged, whereas single words will be stemmed.