Documentation
¶
Index ¶
- Constants
- Variables
- func ComposeSpacesObjectNames(importPath, etag string, numExtraFiles int) []string
- func DeletePackageByPath(importPath string) error
- func DistributeJSFiles()
- func NumDailyActivePackages() int64
- func NumDistributedJSFiles() int64
- func NumGeneratedJSFiles() int64
- func NumMonthlyActivePackages() int64
- func NumRecycledJSFiles() int64
- func NumTotalJSFiles() int64
- func NumTotalPackages() int64
- func NumWeeklyActivePackages() int64
- func RecycleJSFiles()
- func RefreshNumTotalPackages()
- func SaveJSFile(jsFile *JSFile) error
- func SavePkgInfo(pinfo *PkgInfo, updateRefs bool) (err error)
- type JSFile
- type JSFileStatus
- type PkgInfo
- func GetGAERepos() ([]*PkgInfo, error)
- func GetGoRepos() ([]*PkgInfo, error)
- func GetGoSubepos() ([]*PkgInfo, error)
- func GetPkgInfo(importPath string) (*PkgInfo, error)
- func GetPkgInfoByID(id int64) (*PkgInfo, error)
- func GetPkgInfosByIDs(ids []int64) ([]*PkgInfo, error)
- func GetPkgInfosByPaths(paths []string) []*PkgInfo
- func GetSubPkgs(importPath string, dirs []string) []*PkgInfo
- func SearchPkgInfo(limit int, keyword string) ([]*PkgInfo, error)
- type PkgRef
Constants ¶
const PackageVersion = 1
PackageVersion is modified when previously stored packages are invalid.
Variables ¶
var ( ErrEmptyPackagePath = errors.New("package import path is empty") ErrPackageNotFound = errors.New("package does not found") ErrPackageVersionTooOld = errors.New("package version is too old") )
var ErrJSFileNotFound = errors.New("JS file does not exist")
Functions ¶
func DeletePackageByPath ¶
func DistributeJSFiles ¶
func DistributeJSFiles()
DistributeJSFiles uploads local JS files to DigitalOcean Spaces.
func NumDailyActivePackages ¶
func NumDailyActivePackages() int64
func NumDistributedJSFiles ¶
func NumDistributedJSFiles() int64
func NumGeneratedJSFiles ¶
func NumGeneratedJSFiles() int64
func NumMonthlyActivePackages ¶
func NumMonthlyActivePackages() int64
func NumRecycledJSFiles ¶
func NumRecycledJSFiles() int64
func NumTotalJSFiles ¶
func NumTotalJSFiles() int64
func NumTotalPackages ¶
func NumTotalPackages() int64
func NumWeeklyActivePackages ¶
func NumWeeklyActivePackages() int64
func RecycleJSFiles ¶
func RecycleJSFiles()
RecycleJSFiles deletes local or distributed JS files due to inactive status.
func RefreshNumTotalPackages ¶
func RefreshNumTotalPackages()
func SaveJSFile ¶
SaveJSFile inserts or updates JSFile record with given etag.
func SavePkgInfo ¶
SavePkgInfo saves package information.
Types ¶
type JSFile ¶
type JSFile struct { ID int64 PkgID int64 `xorm:"INDEX UNIQUE(pkg_id_etag)"` Etag string `xorm:"UNIQUE(pkg_id_etag)"` Status JSFileStatus NumExtraFiles int // Indicates the number of extra JS files generated }
type JSFileStatus ¶
type JSFileStatus int
const ( JSFileStatusNone JSFileStatus = iota JSFileStatusGenerated JSFileStatusDistributed JSFileStatusRecycled )
type PkgInfo ¶
type PkgInfo struct { ID int64 Name string `xorm:"-"` ImportPath string `xorm:"UNIQUE"` Etag string ProjectPath string ViewDirPath string Synopsis string IsCmd bool IsCgo bool IsGoRepo bool IsGoSubrepo bool IsGaeRepo bool PkgVer int Priority int `xorm:" NOT NULL"` Views int64 Stars int64 ImportNum int64 ImportIDs string `xorm:"import_ids LONGTEXT"` // Import num usually is small so save it to reduce a database query. ImportPaths string `xorm:"LONGTEXT"` RefNum int64 RefIDs string `xorm:"ref_ids LONGTEXT"` Subdirs string `xorm:"TEXT"` LastViewed int64 `xorm:"NOT NULL DEFAULT 0"` Created int64 JSFile *JSFile `xorm:"-"` }
PkgInfo represents the package information.
func GetGAERepos ¶
func GetGoRepos ¶
func GetGoSubepos ¶
func GetPkgInfo ¶
GetPkgInfo returns package information by given import path.
func GetPkgInfoByID ¶
GetPkgInfoByID returns package information by given ID.
func GetPkgInfosByIDs ¶
GetPkgInfosByIDs returns a list of package info by given IDs.
func GetPkgInfosByPaths ¶
GetPkgInfosByPaths returns a list of packages by given import paths.
func GetSubPkgs ¶
GetSubPkgs returns sub-projects by given sub-directories.
func SearchPkgInfo ¶
SearchPkgInfo searches package information by given keyword.
func (*PkgInfo) CanRefresh ¶
CanRefresh returns true if package is available to refresh.
func (*PkgInfo) HasJSFile ¶
HasJSFile returns false if JS file must be regenerated, it populates the JSFile field when file exists.