Documentation
¶
Index ¶
Constants ¶
View Source
const MetaPrefix = "@"
View Source
const WorkDirectory = "../../"
Variables ¶
View Source
var ( Logger = zaplog.NewPackage("goscript", "gendoc").Sugar() OptionDirectory = filepath.Join(WorkDirectory, "./options") GoPackageConfig = &gopackage.Config{ Mode: gopackage.NeedName | gopackage.NeedFiles | gopackage.NeedSyntax, Dir: OptionDirectory, BuildFlags: []string{"-tags=debug"}, Context: context.Background(), Logf: Logger.Infof, Env: os.Environ(), Fset: gotoken.NewFileSet(), } )
View Source
var ErrMissingMetaValue = errors.New("missing meta value")
View Source
var LangList = []LangCode{LangZhCn, LangEnUS}
View Source
var LangMap map[string]LangCode
View Source
var RegisteredOption = map[string]struct{}{
"Options": {},
"LogOption": {},
"DomainOption": {},
"ConnectOption": {},
"DNSOption": {},
"HTTPOption": {},
"DatasourceOption": {},
"CommandDatasourceOption": {},
"HTTPDatasourceOption": {},
"NetlinkDatasourceOption": {},
"DatasourceGroupFailoverOption": {},
"DatasourceGroupSumOption": {},
"ProviderOption": {},
"CloudflareProviderOption": {},
}
Functions ¶
Types ¶
type BaseDocument ¶
func (*BaseDocument) FromComment ¶
func (o *BaseDocument) FromComment(comment *goast.CommentGroup, tokenHandler TokenNameHandler, ) error
func (*BaseDocument) FromToken ¶
func (o *BaseDocument) FromToken(token *Tokenizer, tokenHandler TokenNameHandler, ) error
type FieldDocument ¶
type FieldDocument struct {
BaseDocument
Ast *goast.Field
YAML *jsonschema.FieldTagInfo
Values []string
Platform []string
}
func (*FieldDocument) FromTokenName ¶
func (o *FieldDocument) FromTokenName(name string, t *Tokenizer) error
func (*FieldDocument) Required ¶
func (o *FieldDocument) Required() bool
type StructDocument ¶
type StructDocument struct {
BaseDocument
Ast *goast.StructType
AstTypeSpec *goast.TypeSpec
Fields []*FieldDocument
}
func NewStruct ¶
func NewStruct(gendecl *goast.GenDecl, typeSpec *goast.TypeSpec, structType *goast.StructType) (*StructDocument, error)
func (*StructDocument) FromTokenName ¶
func (o *StructDocument) FromTokenName(name string, token *Tokenizer) error
type TokenNameHandler ¶
type Tokenizer ¶
type Tokenizer struct {
// contains filtered or unexported fields
}
func NewTokenizer ¶
func NewTokenizerString ¶
func (*Tokenizer) FragmentText ¶
Click to show internal directories.
Click to hide internal directories.