parser

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: MIT Imports: 14 Imported by: 0

README

Parsers

Package is responsible for parsing data out of connectors, next parsers a supported:

  1. HTML
  2. JSON
  3. XPath
  4. XML(In progress)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory func([]byte, logger.Logger) Parser
var (
	JsonFactory Factory = func(bytes []byte, logger logger.Logger) Parser {
		return newJson(bytes).WithLogger(logger.With("parser", "json"))
	}

	HTMLFactory Factory = func(bytes []byte, logger logger.Logger) Parser {
		return newHTML(bytes).WithLogger(logger.With("parser", "html"))
	}

	XPathFactory Factory = func(bytes []byte, logger logger.Logger) Parser {
		return newXPath(bytes).WithLogger(logger.With("parser", "xpath"))
	}
)

type ParseResult

type ParseResult struct {
	Raw string `json:"raw"`
}

func (*ParseResult) IsEmpty added in v0.0.6

func (p *ParseResult) IsEmpty() bool

func (*ParseResult) ToJson

func (p *ParseResult) ToJson() string

type Parser

type Parser interface {
	Parse(model *config.Model) (*ParseResult, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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