Documentation ¶
Overview ¶
Package models implemented database access funtions.
Index ¶
- func DeleteProject(path string)
- func FlushCacheProjects(pinfos []hv.PkgInfo)
- func GetGoRepo() (pinfos []*hv.PkgInfo)
- func GetGoSubrepo() (pinfos []*hv.PkgInfo)
- func GetGroupPkgInfo(paths []string) []*hv.PkgInfo
- func GetGroupPkgInfoById(pids []string) []*hv.PkgInfo
- func GetImports(spid, tag string) []*hv.PkgInfo
- func GetIndexPkgs(page int) (pkgs []hv.PkgInfo)
- func GetIndexStats() (int64, int64, int64)
- func GetPkgInfo(path, tag string) (*hv.PkgInfo, error)
- func GetPkgInfoById(pid int) (pinfo *hv.PkgInfo, err error)
- func GetRefs(spid string) []*hv.PkgInfo
- func GetSubPkgs(importPath, tag string, dirs []string) []hv.PkgInfo
- func InitDb()
- func SavePkgExam(gist *PkgExam) error
- func SaveProject(pinfo *hv.PkgInfo, pdecl *PkgDecl, pfuncs []PkgFunc, imports []string) error
- func SearchPkg(key string, isCmd, isCgo, isGoRepo, isGoSubrepo int, isSynopsis bool) (pinfos []hv.PkgInfo)
- type PkgDecl
- type PkgExam
- type PkgFunc
- type PkgImport
- type PkgRock
- type PkgTag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteProject ¶
func DeleteProject(path string)
DeleteProject deletes everything of the package, and update import information.
func FlushCacheProjects ¶
FlushCacheProjects saves cache data to database.
func GetGoSubrepo ¶
func GetGroupPkgInfo ¶
GetGroupPkgInfo returns group of package infomration in order to reduce database connect times.
func GetGroupPkgInfoById ¶
GetGroupPkgInfoById returns group of package infomration by pid.
func GetImports ¶
func GetIndexPkgs ¶
GetIndexPkgs returns package information in given page.
func GetIndexStats ¶
GetIndexStats returns index page statistic information.
func GetPkgInfo ¶
GetPkgInfo returns 'PkgInfo' by given import path and tag. It returns error when the package does not exist.
func GetPkgInfoById ¶
GetPkgInfoById returns package information from database by pid.
func GetSubPkgs ¶
GetSubPkgs returns sub-projects by given sub-directories.
func SaveProject ¶
SaveProject saves package information, declaration and functions; update import information.
Types ¶
type PkgDecl ¶
type PkgDecl struct { Id int64 Pid int64 `xorm:"unique(pkg_decl_pid_tag) index"` Tag string `xorm:"unique(pkg_decl_pid_tag) VARCHAR(50)"` // Indicate how many JS should be downloaded(JsNum=total num - 1) JsNum int IsHasExport bool // Top-level declarations. IsHasConst, IsHasVar bool IsHasExample bool Imports, TestImports string `xorm:"TEXT"` IsHasFile bool IsHasSubdir bool }
PkgDecl is package declaration in database acceptable form.
type PkgExam ¶
type PkgExam struct { Id int64 Path string `xorm:"index VARCHAR(150)"` Gist string `xorm:"VARCHAR(150)"` // Gist path. Examples string `xorm:"TEXT"` // Examples. Created time.Time `xorm:"index"` }
A PkgExam descriables the user example of the project.
func GetAllExams ¶
GetAllExams returns all user examples.
func GetPkgExams ¶
GetPkgExams returns user examples.
type PkgFunc ¶
type PkgFunc struct { Id int64 Pid int64 `xorm:"index"` // Id of package documentation it belongs to. Path string `xorm:"VARCHAR(150)"` Name string `xorm:"index VARCHAR(100)"` Doc string `xorm:"TEXT"` IsOld bool // Indicates if the function no longer exists. }
PkgFunc represents a package function.
func SearchFunc ¶
SearchFunc returns functions that name contains keyword.
type PkgImport ¶
type PkgImport struct { Id int64 Path string `xorm:"index VARCHAR(150)"` Imports string `xorm:"TEXT"` }
PkgImport represents a package imports record.
type PkgRock ¶
type PkgRock struct { Id int64 Pid int64 `xorm:"index"` Path string `xorm:"VARCHAR(150)"` Rank int64 Delta int64 `xorm:"index"` }
A PkgRock descriables the trending rank of the project.
type PkgTag ¶
type PkgTag struct { Id int64 Path string `xorm:"unique(pkg_tag_path_tag) index VARCHAR(150)"` Tag string `xorm:"unique(pkg_tag_path_tag) VARCHAR(50)"` Vcs string `xorm:"VARCHAR(50)"` Tags string `xorm:"TEXT"` }
A PkgTag descriables the project revision tag for its sub-projects, any project that has this record means it's passed check of Go project, and do not need to download whole project archive when refresh.