models

package
v0.0.0-...-74ee40a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const PACKAGE_VER = 1

PACKAGE_VER is modified when previously stored packages are invalid.

Variables

View Source
var (
	ErrEmptyPackagePath     = errors.New("Package import path is empty")
	ErrPackageNotFound      = errors.New("Package does not found")
	ErrPackageVersionTooOld = errors.New("Package version is too old")
)

Functions

func DeletePackageByPath

func DeletePackageByPath(importPath string) error

func NumTotalPackages

func NumTotalPackages() int64

func SavePkgInfo

func SavePkgInfo(pinfo *PkgInfo, updateRefs bool) (err error)

SavePkgInfo saves package information.

Types

type PkgInfo

type PkgInfo struct {
	ID         int64  `xorm:"pk autoincr"`
	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
	// Indicate how many JS should be downloaded(JsNum=total num - 1)
	JsNum int

	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:"-"`
	Created    int64
}

PkgInfo represents the package information.

func GetGAERepos

func GetGAERepos() ([]*PkgInfo, error)

func GetGoRepos

func GetGoRepos() ([]*PkgInfo, error)

func GetGoSubepos

func GetGoSubepos() ([]*PkgInfo, error)

func GetPkgInfo

func GetPkgInfo(importPath string) (*PkgInfo, error)

GetPkgInfo returns package information by given import path.

func GetPkgInfoById

func GetPkgInfoById(id int64) (*PkgInfo, error)

GetPkgInfoById returns package information by given ID.

func GetPkgInfosByIDs

func GetPkgInfosByIDs(ids []int64) ([]*PkgInfo, error)

GetPkgInfosByIDs returns a list of package info by given IDs.

func GetPkgInfosByPaths

func GetPkgInfosByPaths(paths []string) []*PkgInfo

GetPkgInfosByPaths returns a list of packages by given import paths.

func GetSubPkgs

func GetSubPkgs(importPath string, dirs []string) []*PkgInfo

GetSubPkgs returns sub-projects by given sub-directories.

func SearchPkgInfo

func SearchPkgInfo(limit int, keyword string) ([]*PkgInfo, error)

SearchPkgInfo searches package information by given keyword.

func (*PkgInfo) CanRefresh

func (p *PkgInfo) CanRefresh() bool

CanRefresh returns true if package is available to refresh.

func (*PkgInfo) GetRefs

func (p *PkgInfo) GetRefs() []*PkgInfo

GetRefs returns a list of packages that import this one.

func (*PkgInfo) JSPath

func (p *PkgInfo) JSPath() string

type PkgRef

type PkgRef struct {
	ID         int64  `xorm:"pk autoincr"`
	ImportPath string `xorm:"UNIQUE"`
	RefNum     int64
	RefIDs     string `xorm:"ref_ids LONGTEXT"`
}

PkgRef represents temporary reference information of a package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL