Documentation ¶
Index ¶
- Constants
- Variables
- func CheckPackage(importPath string, render macaron.Render, rt requestType) (*models.PkgInfo, error)
- func FormatCode(w io.Writer, code *string, links []*Link)
- func RefreshSearchContent()
- func SaveDocPage(docPath string, data []byte) int
- func SavePkgDoc(docPath string, readmes map[string][]byte)
- type Annotation
- type AnnotationKind
- type Code
- type Example
- type File
- type Func
- type Link
- type Package
- type PkgDecl
- type RepoInfo
- type Source
- type Type
- type Value
- type WalkDepth
- type WalkMode
- type WalkRes
- type WalkType
- type Walker
Constants ¶
const ( REQUEST_TYPE_HUMAN requestType = iota REQUEST_TYPE_REFRESH )
Variables ¶
var ( ErrInvalidRemotePath = errors.New("Invalid package remote path") ErrNoServiceMatch = errors.New("Package remote path does not match any service") )
var ( ErrPackageNotModified = errors.New("Package has not been modified") ErrPackageNoGoFile = errors.New("Package does not contain Go file") )
var (
Client = &http.Client{Transport: httpTransport}
)
var (
ErrFetchTimeout = errors.New("Fetch package timeout")
)
var SearchContent string
Functions ¶
func CheckPackage ¶
func CheckPackage(importPath string, render macaron.Render, rt requestType) (*models.PkgInfo, error)
CheckGoPackage checks package by import path.
func FormatCode ¶
FormatCode highlights keywords and adds HTML links to them.
func RefreshSearchContent ¶
func RefreshSearchContent()
func SaveDocPage ¶
SaveDocPage saves doc. content to JS file(s), it returns max index of JS file(s); it returns -1 when error occurs.
func SavePkgDoc ¶
SavePkgDoc saves readered readme.md file data.
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 Link ¶
type Link struct {
Path, Name, Comment string // package path, identifier name, and comments.
}
A link describes the (HTML) link information for an identifier. The zero value of a link represents "no link".
type Package ¶
type Package struct { *models.PkgInfo Readme map[string][]byte *PkgDecl IsHasExport bool // Top-level declarations. IsHasConst, IsHasVar bool IsHasExample bool IsHasFile bool IsHasSubdir bool }
Package represents 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 []*Example // Function or method example. Imports, TestImports []string // Imports. Files, TestFiles []*Source // Source files. Notes []string // Source code notes. Dirs []string // Subdirectories }
PkgDecl is package declaration in database acceptable form.
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.