Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
Field represents a field in a struct It contains the name of the field, the type and the tags This information are extracted from the file and will be used to generate the variables files
type File ¶
File represents a project file It contains the path of the file, the package name and the structs This information are extracted from the file and will be used to generate the variables files
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
type Preprocessor ¶
type Preprocessor struct { // Include is a boolean that indicates if the struct should be included or not // The default value is true Include bool // IncludeTags is a list of tags that should be included // The default value is nil IncludeTags []string // Exclude is a boolean that indicates if the struct should be excluded or not // The default value is false Exclude bool // ExcludeTags is a list of tags that should be excluded // The default value is nil ExcludeTags []string // contains filtered or unexported fields }
Preprocessor is the preprocessor
The preprocessor parse the string and extract the options This options will be used to know if a struct should be included or not and to know which tags to include
#tagsvar:all -> include the struct and all the fields with all the tags (equivalent to #tagsvar) #tagsvar:include -> include the struct and all the fields (equivalent to #tagsvar) #tagsvar:include:all -> include the struct and all the fields with all the tags (equivalent to #tagsvar) #tagsvar:include:json -> include the struct and all the fields with the json tag #tagsvar:include:json,xml -> include the struct and all the fields with the json and xml tags #tagsvar:exclude -> exclude the struct and all the fields #tagsvar:exclude:all -> exclude the struct and all the fields with all the tags (equivalent to #tagsvar:exclude) #tagsvar:exclude:json -> only exclude the fields with the json tag #tagsvar:exclude:json,xml" -> only exclude the fields with the json and xml tags
Exclude is the default behavior, so if the preprocessor is not found in the comment, the struct will be excluded If the preprocessor is found and contains the include and exclude keywords, the exclude keyword will have the priority
func NewPreprocessor ¶
func NewPreprocessor() *Preprocessor
NewPreprocessor returns a new preprocessor
func (*Preprocessor) DoProcess ¶
func (p *Preprocessor) DoProcess() bool
DoProcess returns true if the struct should be included and false if the struct should be excluded
func (*Preprocessor) Parse ¶
func (p *Preprocessor) Parse(s string)
Parse parses the string and extract the options
func (*Preprocessor) ShouldProcess ¶
func (p *Preprocessor) ShouldProcess(tag string) bool
ShouldProcess returns true if the tag should be included and false if the tag should be excluded
type Struct ¶
Struct represents a struct in a project file It contains the name of the struct and the fields This information are extracted from the file and will be used to generate the variables files