Documentation
¶
Index ¶
- type CodeElement
- type GocodeStreamParser
- func (p *GocodeStreamParser) GetSupportedTypes() []string
- func (p *GocodeStreamParser) Parse(ctx context.Context, content []byte, metadata map[string]any) (*core.Document, error)
- func (p *GocodeStreamParser) ParseStream(ctx context.Context, r io.Reader, metadata map[string]any) (<-chan *core.Document, error)
- func (p *GocodeStreamParser) SetChunkOverlap(overlap int)
- func (p *GocodeStreamParser) SetChunkSize(size int)
- func (p *GocodeStreamParser) SetExtractComments(enabled bool)
- func (p *GocodeStreamParser) SetExtractFunctions(enabled bool)
- func (p *GocodeStreamParser) SetExtractTypes(enabled bool)
- func (p *GocodeStreamParser) Supports(contentType string) bool
- type Parser
- func (p *Parser) Parse(ctx context.Context, r io.Reader) ([]core.Chunk, error)
- func (p *Parser) ParseWithCallback(ctx context.Context, r io.Reader, callback func(core.Chunk) error) error
- func (p *Parser) SetChunkOverlap(overlap int)
- func (p *Parser) SetChunkSize(size int)
- func (p *Parser) SetExtractComments(enabled bool)
- func (p *Parser) SetExtractFunctions(enabled bool)
- func (p *Parser) SetExtractTypes(enabled bool)
- func (p *Parser) SupportedFormats() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodeElement ¶
type CodeElement struct {
Kind string // "function", "type", "comment"
Name string
Start int
End int
Content string
Metadata map[string]string
}
CodeElement represents a code element (function, type, comment)
type GocodeStreamParser ¶
type GocodeStreamParser struct {
// contains filtered or unexported fields
}
func DefaultGocodeStreamParser ¶ added in v1.1.3
func DefaultGocodeStreamParser() *GocodeStreamParser
DefaultGocodeStreamParser creates a new Go code stream parser
func (*GocodeStreamParser) GetSupportedTypes ¶
func (p *GocodeStreamParser) GetSupportedTypes() []string
GetSupportedTypes returns the supported file formats
func (*GocodeStreamParser) Parse ¶
func (p *GocodeStreamParser) Parse(ctx context.Context, content []byte, metadata map[string]any) (*core.Document, error)
Parse implements core.Parser interface.
func (*GocodeStreamParser) ParseStream ¶
func (p *GocodeStreamParser) ParseStream(ctx context.Context, r io.Reader, metadata map[string]any) (<-chan *core.Document, error)
ParseStream implements the core.Parser interface
func (*GocodeStreamParser) SetChunkOverlap ¶
func (p *GocodeStreamParser) SetChunkOverlap(overlap int)
SetChunkOverlap sets the chunk overlap
func (*GocodeStreamParser) SetChunkSize ¶
func (p *GocodeStreamParser) SetChunkSize(size int)
SetChunkSize sets the chunk size
func (*GocodeStreamParser) SetExtractComments ¶
func (p *GocodeStreamParser) SetExtractComments(enabled bool)
SetExtractComments enables or disables comment extraction
func (*GocodeStreamParser) SetExtractFunctions ¶
func (p *GocodeStreamParser) SetExtractFunctions(enabled bool)
SetExtractFunctions enables or disables function extraction
func (*GocodeStreamParser) SetExtractTypes ¶
func (p *GocodeStreamParser) SetExtractTypes(enabled bool)
SetExtractTypes enables or disables type extraction
func (*GocodeStreamParser) Supports ¶
func (p *GocodeStreamParser) Supports(contentType string) bool
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser implements Go code parser with streaming support (default behavior)
func DefaultParser ¶ added in v1.1.3
func DefaultParser() *Parser
DefaultParser creates a new Go code parser (streaming by default)
func (*Parser) ParseWithCallback ¶
func (p *Parser) ParseWithCallback(ctx context.Context, r io.Reader, callback func(core.Chunk) error) error
ParseWithCallback parses Go code and calls the callback for each chunk This is the primary method - all parsing is streaming by default
func (*Parser) SetChunkOverlap ¶
SetChunkOverlap sets the chunk overlap
func (*Parser) SetChunkSize ¶
SetChunkSize sets the chunk size
func (*Parser) SetExtractComments ¶
SetExtractComments enables or disables comment extraction
func (*Parser) SetExtractFunctions ¶
SetExtractFunctions enables or disables function extraction
func (*Parser) SetExtractTypes ¶
SetExtractTypes enables or disables type extraction
func (*Parser) SupportedFormats ¶
SupportedFormats returns supported file formats