Documentation ¶
Overview ¶
Package Hacker View provides APIs to analyze Go projects and generate AST-based source code view.
Index ¶
Constants ¶
const PACKAGE_VER = 1
PACKAGE_VER is modified when previously stored packages are invalid.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
type Annotation struct {
Pos, End int16
Kind AnnotationKind
ImportPath string
}
type AnnotationKind ¶
type AnnotationKind int16
const ( ExportLinkAnnotation AnnotationKind = iota AnchorAnnotation CommentAnnotation PackageLinkAnnotation BuiltinAnnotation )
type Code ¶
type Code struct { Text string Annotations []Annotation }
type Example ¶
type Example struct { Name string Doc string Code string //Play string Output string IsUsed bool // Indicates if it's used by any kind object. }
Example represents function or method examples.
type File ¶
type File struct { // Top-level declarations. Consts []*Value Funcs []*Func Types []*Type Vars []*Value // Internal declarations. Ifuncs []*Func Itypes []*Type }
A File describles declaration of file.
type Func ¶
type Func struct {
Name, FullName string
Doc string
Decl, FmtDecl string
URL string // VCS URL.
Code string // Included field 'Decl', formatted.
Examples []*Example
}
Func represents functions
type Gist ¶
type Gist struct { ImportPath string `xorm:"index VARCHAR(150)"` Gist string // Gist path. Examples []*Example // Examples. }
Gist represents a Gist.
type Link ¶
type Link struct {
Path, Name, Comment string
}
A link describes the (HTML) link information for an identifier. The zero value of a link represents "no link".
type Package ¶
type Package struct { *PkgInfo Readme map[string][]byte *PkgDecl IsNeedRender bool IsHasExport bool // Top-level declarations. IsHasConst, IsHasVar bool IsHasExample bool IsHasFile bool IsHasSubdir bool }
A Package describles the full documentation and declaration of a project or package.
type PkgDecl ¶
type PkgDecl struct { Tag string // Current tag of project. Doc string // Package documentation(doc.go). File Examples, UserExamples []*Example // Function or method example. Imports, TestImports []string // Imports. Files, TestFiles []*Source // Source files. Notes []string // Source code notes. Dirs []string // Subdirectories // Indicate how many JS should be downloaded(JsNum=total num - 1) JsNum int }
PkgDecl is package declaration in database acceptable form.
type PkgInfo ¶
type PkgInfo struct { Id int64 `json:"id"` ImportPath string `xorm:"index VARCHAR(150)" json:"import_path"` ProjectName string `xorm:"VARCHAR(50)" json:"project_name"` ProjectPath string `xorm:"VARCHAR(120)" json:"project_path"` ViewDirPath string `xorm:"VARCHAR(120)" json:"-"` Synopsis string `xorm:"VARCHAR(300)" json:"synopsis"` /* - Indicates whether it's a command line tool or package. - Indicates whether it uses cgo / os/user or not. - Indicates whether it belongs to Go standard library. - Indicates whether it's developed by Go team. */ IsCmd bool `json:"cmd"` IsCgo bool `json:"cgo"` IsGoRepo bool `json:"go_repo"` IsGoSubrepo bool `json:"go_subrepo"` /* - All tags of project. eg. master|||v0.6.2.0718 - Views of projects. - User viewed time(Unix-timestamp). eg. 1374127619 - Time when information last updated(UTC). eg. 2013-07-16 21:09:27.48932087 */ Tags string `xorm:"-" json:"tags"` Views int64 `xorm:"index" json:"-"` ViewedTime int64 `json:"-"` Created int64 `xorm:"index" json:"-"` /* - Rank is the benchmark of projects, it's based on BaseRank and views. */ Rank int64 `xorm:"index" json:"-"` /* - Package (structure) version. eg. 9 - Project revision. eg. 8976ce8b2848 - Project labels. eg. $tool| */ PkgVer int `json:"-"` Ptag string `xorm:"VARCHAR(50)" json:"-"` Labels string `xorm:"TEXT" json:"-"` /* - Number of projects that import this project. - Ids of projects that import this project. eg. $47|$89|$5464|$8586|$8595|$8787|$8789|$8790|$8918|$9134|$9139| */ RefNum int `json:"-"` RefPids string `xorm:"TEXT" json:"-"` /* - Addtional information. */ Vcs string `xorm:"-" json:"-"` Homepage string `xorm:"VARCHAR(100)" json:"homepage"` ForkUrl string `xorm:"VARCHAR(150)" json:"-"` Issues, Stars, Forks int `json:"-"` Note string `xorm:"TEXT" json:"-"` SourceSize int64 `json:"-"` }
A PkgInfo describles a project information.
type Render ¶
type Render struct { Links []*Link FilteList map[string]bool // contains filtered or unexported fields }
A Render describles a code render.
type Type ¶
type Type struct { Name string // Type name. Doc string Decl, FmtDecl string // Normal and formatted form of declaration. URL string // VCS URL. Consts, Vars []*Value Funcs []*Func // Exported functions that return this type. Methods []*Func // Exported methods. IFuncs []*Func // Internal functions that return this type. IMethods []*Func // Internal methods. Examples []*Example }
Type represents structs and interfaces.
type Value ¶
type Value struct { Name string // Value name. Doc string Decl, FmtDecl string // Normal and formatted form of declaration. URL string // VCS URL. }
Value represents constants and variable
type Walker ¶
type Walker struct { LineFmt string Pdoc *Package Examples []*doc.Example // Function or method example. Fset *token.FileSet SrcLines map[string][]string // Source file line slices. SrcFiles map[string]*Source Buf []byte // scratch space for printNode method. // contains filtered or unexported fields }
Walker holds the state used when building the documentation.