yakdocument

package
v1.3.4-alpha0725 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Entry = map[string]StructDoc{}

Functions

func AddDoc

func AddDoc(pkg, structName string, fields []*FieldDoc, methods ...*MethodDoc)

func DumpReflectType

func DumpReflectType(t reflect.Type, verbose ...string) string

func DumpReflectTypeEx

func DumpReflectTypeEx(t reflect.Type, method bool, verbose ...string) string

func DumpReturnTypes

func DumpReturnTypes(types []reflect.Type) string

func DumpTypes

func DumpTypes(types []reflect.Type, isVariadic bool) string

func LibDocsToCompletionJson

func LibDocsToCompletionJson(libs ...LibDoc) ([]byte, error)

func LibDocsToCompletionJsonEx

func LibDocsToCompletionJsonEx(all bool, libs ...LibDoc) ([]byte, error)

func LibDocsToCompletionJsonShort

func LibDocsToCompletionJsonShort(libs ...LibDoc) ([]byte, error)

func StructName

func StructName(libName, pkgPath, name string) string

Types

type ExportsFunctionDoc

type ExportsFunctionDoc struct {
	Name            string
	LibName         string `yaml:"-"`
	TypeStr         string `yaml:"type_str"`
	LongDescription string `yaml:"long_description"`
	Description     string
	Example         string       `yaml:"example,omitempty"`
	Params          []*FieldDoc  `yaml:"params,omitempty"`
	Returns         []*FieldDoc  `yaml:"returns,omitempty"`
	RelativeStructs []*StructDoc `yaml:"relative_structs,omitempty"`
}

func ReflectFuncToFunctionDoc

func ReflectFuncToFunctionDoc(libName string, ret reflect.Type) (ExportsFunctionDoc, error)

func (*ExportsFunctionDoc) CompletionStr

func (e *ExportsFunctionDoc) CompletionStr() string

func (*ExportsFunctionDoc) DefinitionStr

func (e *ExportsFunctionDoc) DefinitionStr() string

func (*ExportsFunctionDoc) Fragment

func (e *ExportsFunctionDoc) Fragment() string

func (*ExportsFunctionDoc) Hash

func (e *ExportsFunctionDoc) Hash() string

func (*ExportsFunctionDoc) Merge

func (e *ExportsFunctionDoc) Merge(target *ExportsFunctionDoc)

type FieldDoc

type FieldDoc struct {
	StructName         string `yaml:"structname,omitempty"`
	Name               string
	ParamAlias         string `yaml:"param_alias"`
	TypeAlias          string `yaml:"type_alias"`
	Description        string
	RelativeStructName string `yaml:"relative_structname,omitempty"`
	TypeStr            string `yaml:"type_str"`
	IsVariadic         bool   `yaml:"is_variadic,omitempty"`
}

func (*FieldDoc) Hash

func (f *FieldDoc) Hash() string

func (*FieldDoc) NameVerbose

func (f *FieldDoc) NameVerbose() string

func (*FieldDoc) TypeVerbose

func (f *FieldDoc) TypeVerbose() string

type FieldsCompletion

type FieldsCompletion struct {
	IsMethod                 bool   `json:"isMethod"`
	FieldName                string `json:"fieldName"`
	FieldTypeVerbose         string `json:"fieldTypeVerbose"`
	LibName                  string `json:"libName"`
	StructName               string `json:"structName"`
	StructNameShort          string `json:"structNameShort"`
	MethodsCompletion        string `json:"methodsCompletion"`
	MethodsCompletionVerbose string `json:"methodsCompletionVerbose"`
	IsGolangBuildOrigin      bool   `json:"isGolangBuildOrigin"`
}

type LibDoc

type LibDoc struct {
	Name      string
	Functions []*ExportsFunctionDoc
	Variables []*VariableDoc
}

func (*LibDoc) Hash

func (l *LibDoc) Hash() string

func (*LibDoc) Merge

func (l *LibDoc) Merge(e *LibDoc)

func (*LibDoc) ToMarkdown

func (l *LibDoc) ToMarkdown() string

type MethodDoc

type MethodDoc struct {
	Ptr                bool `yaml:"ptr,omitempty"`
	Description        string
	StructName         string
	Name               string
	Params             []*FieldDoc  `yaml:"params,omitempty"`
	Returns            []*FieldDoc  `yaml:"returns,omitempty"`
	RelativeStructName []*StructDoc `yaml:"relative_struct_name"`
}

func FuncToDoc

func FuncToDoc(ret reflect.Type, ptr bool, isMethod bool) (*MethodDoc, error)

func MethodToDoc

func MethodToDoc(m reflect.Method, ptr bool, structName string) *MethodDoc

func (*MethodDoc) Hash

func (m *MethodDoc) Hash() string

type StructDoc

type StructDoc struct {
	StructName      string
	IsBuildInStruct bool
	LibName         string       `yaml:"-"`
	Description     string       `yaml:"-"`
	Fields          []*FieldDoc  `yaml:"-"`
	MethodsDoc      []*MethodDoc `yaml:"-"`
	PtrMethodDoc    []*MethodDoc `yaml:"-"`
}

func StructHelperToDoc

func StructHelperToDoc(h *StructHelper) []*StructDoc

func (*StructDoc) IsBuildInLib

func (s *StructDoc) IsBuildInLib() bool

type StructDocForYamlMarshal

type StructDocForYamlMarshal struct {
	IsBuildInStruct bool         `yaml:"is_build_in_struct"`
	LibName         string       `json:"lib_name"`
	StructName      string       `yaml:"struct_name"`
	Description     string       `yaml:"description"`
	Fields          []*FieldDoc  `yaml:"fields"`
	MethodsDoc      []*MethodDoc `yaml:"methods"`
	PtrMethodDoc    []*MethodDoc `yaml:"ptr_methods"`
}

func LibsToRelativeStructs

func LibsToRelativeStructs(libs ...LibDoc) []*StructDocForYamlMarshal

func (*StructDocForYamlMarshal) GenerateCompletion

func (s *StructDocForYamlMarshal) GenerateCompletion() []FieldsCompletion

func (*StructDocForYamlMarshal) IsBuildInLib

func (s *StructDocForYamlMarshal) IsBuildInLib() bool

func (*StructDocForYamlMarshal) Merge

type StructHelper

type StructHelper struct {
	PkgPath    string
	Name       string
	Fields     []reflect.StructField
	Methods    []reflect.Method
	PtrMethods []reflect.Method
}

func DescPtrStruct

func DescPtrStruct(ret reflect.Type) (_ *StructHelper, fErr error)

func DescStruct

func DescStruct(ret reflect.Type) (*StructHelper, error)

func Dir

func Dir(i interface{}) (*StructHelper, error)

func (*StructHelper) Show

func (s *StructHelper) Show()

func (*StructHelper) ShowAddDocHelper

func (s *StructHelper) ShowAddDocHelper()

func (*StructHelper) String

func (s *StructHelper) String() string

type VariableDoc

type VariableDoc struct {
	Name           string
	TypeStr        string
	ValueVerbose   string
	Description    string
	RelativeStruct []*StructDoc `yaml:"relative_struct,omitempty"`
}

func (*VariableDoc) Hash

func (e *VariableDoc) Hash() string

type YakCompletion

type YakCompletion struct {
	LibNames              []string                      `json:"libNames"`
	LibCompletions        []YakLibDocCompletion         `json:"libCompletions"`
	FieldsCompletions     []FieldsCompletion            `json:"fieldsCompletions"`
	LibToFieldCompletions map[string][]FieldsCompletion `json:"libToFieldCompletions"`
}

type YakFunctionCompletion

type YakFunctionCompletion struct {
	Function         string `json:"functionName"`
	FunctionDocument string `json:"document"`
	DefinitionStr    string `json:"definitionStr"`
}

type YakLibDocCompletion

type YakLibDocCompletion struct {
	LibName            string                  `json:"libName"`
	Prefix             string                  `json:"prefix"`
	FunctionCompletion []YakFunctionCompletion `json:"functions"`
}

Jump to

Keyboard shortcuts

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