{"modulePath":"github.com/raystack/meteor","version":"v0.14.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package plugins\n\n## Variables\n\n```go\nvar ErrEmptyURNScope = errors.New(\"urn scope is required to generate unique urn\")\n```\n\n## Functions\n\n```go\nfunc BQErrReason(err error) string\n```\n\n```go\nfunc BigQueryTableFQNToURN(fqn string) (string, error)\n```\n\n```go\nfunc BigQueryURN(projectID, datasetID, tableID string) string\n```\n\n```go\nfunc DrainBody(resp *http.Response)\n```\nDrainBody drains and closes the response body to avoid the following gotcha: [http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang/index.html#close\\_http\\_resp\\_body](http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang/index.html#close_http_resp_body)\n\n```go\nfunc GetLog() log.Logger\n```\nGetLog returns the logger\n\n```go\nfunc KafkaServersToScope(servers string) string\n```\n\n```go\nfunc KafkaURN(bootstrapServers, topic string) string\n```\n\n```go\nfunc MaxComputeTableFQNToURN(fqn string) (string, error)\n```\n\n```go\nfunc MaxComputeURN(projectID, schemaName, tableName string) string\n```\n\n```go\nfunc NewRetryError(err error) error\n```\n\n```go\nfunc SetLog(l log.Logger)\n```\nSetLog sets the logger\n\n## Types\n\n```go\ntype BaseExtractor struct {\n\tScopeNotRequired bool\n\tBasePlugin\n}\n```\n\n```go\nfunc NewBaseExtractor(info Info, configRef any) BaseExtractor\n```\n\n```go\nfunc (p *BaseExtractor) Init(ctx context.Context, config Config) error\n```\nInit will be called once before running the plugin. This is where you want to initiate any client or test any connection to external service.\n\n```go\nfunc (p *BaseExtractor) Validate(config Config) error\n```\nValidate checks if the given options is valid for the plugin.\n\n```go\ntype BasePlugin struct {\n\tUrnScope  string\n\tRawConfig map[string]any\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewBasePlugin(info Info, configRef any) BasePlugin\n```\n\n```go\nfunc (p *BasePlugin) Info() Info\n```\nInfo returns plugin's information.\n\n```go\nfunc (p *BasePlugin) Init(ctx context.Context, config Config) error\n```\nInit will be called once before running the plugin. This is where you want to initiate any client or test any connection to external service.\n\n```go\nfunc (p *BasePlugin) Validate(config Config) error\n```\nValidate checks if the given options is valid for the plugin.\n\n```go\ntype Config struct {\n\tURNScope  string\n\tRawConfig map[string]any\n}\n```\n\n```go\ntype ConfigError struct {\n\tKey     string\n\tMessage string\n}\n```\nConfigError contains fields to check error\n\n```go\ntype EdgeInfo struct {\n\tType string `yaml:\"type\"` // e.g. \"derived_from\", \"owned_by\", \"references\"\n\tFrom string `yaml:\"from\"` // source entity type\n\tTo   string `yaml:\"to\"`   // target entity type\n}\n```\nEdgeInfo describes an edge type produced by a plugin.\n\n```go\ntype Emit func(models.Record)\n```\n\n```go\ntype EntityInfo struct {\n\tType       string `yaml:\"type\"`        // e.g. \"table\", \"topic\", \"dashboard\"\n\tURNPattern string `yaml:\"urn_pattern\"` // e.g. \"urn:bigquery:{project_id}:table:{dataset}.{table}\"\n}\n```\nEntityInfo describes an entity type produced by a plugin.\n\n```go\ntype Extractor interface {\n\tPlugin\n\tExtract(ctx context.Context, emit Emit) (err error)\n}\n```\nExtractor is a plugin that extracts data from a source.\n\n```go\ntype Info struct {\n\tDescription  string       `yaml:\"description\"`\n\tSampleConfig string       `yaml:\"sample_config\"`\n\tTags         []string     `yaml:\"tags\"`\n\tSummary      string       `yaml:\"summary\"`\n\tEntities     []EntityInfo `yaml:\"entities\"`\n\tEdges        []EdgeInfo   `yaml:\"edges\"`\n}\n```\nInfo represents the meta.yaml file of a plugin.\n\n```go\ntype InvalidConfigError struct {\n\tType       PluginType\n\tPluginName string\n\tErrors     []ConfigError\n}\n```\nInvalidConfigError is returned when a plugin's configuration is invalid.\n\n```go\nfunc (err InvalidConfigError) Error() string\n```\n\n```go\nfunc (err InvalidConfigError) HasError() bool\n```\n\n```go\ntype NotFoundError struct {\n\tType      PluginType\n\tName      string\n\tAvailable []string // populated by registry for suggestions\n}\n```\nNotFoundError contains fields required to checks for a missing plugin.\n\n```go\nfunc (err NotFoundError) Error() string\n```\n\n```go\nfunc (err NotFoundError) Is(target error) bool\n```\n\n```go\ntype Plugin interface {\n\t// Info returns plugin's information.\n\tInfo() Info\n\n\t// Validate checks if the given options is valid for the plugin.\n\tValidate(config Config) error\n\n\t// Init will be called once before running the plugin.\n\t// This is where you want to initiate any client or test any connection to external service.\n\tInit(ctx context.Context, config Config) error\n}\n```\n\n```go\ntype PluginType string\n```\nPluginType is the type of plugin.\n\n```go\nconst (\n\tPluginTypeExtractor PluginType = \"extractor\"\n\tPluginTypeProcessor PluginType = \"processor\"\n\tPluginTypeSink      PluginType = \"sink\"\n)\n```\nPluginType names\n\n```go\ntype Processor interface {\n\tPlugin\n\tProcess(ctx context.Context, src models.Record) (dst models.Record, err error)\n}\n```\nProcessor are the functions that are executed on the extracted data.\n\n```go\ntype RetryError struct {\n\tErr error\n}\n```\nRetryError is an error signalling that retry is needed for the operation.\n\n```go\nfunc (e RetryError) Error() string\n```\n\n```go\nfunc (e RetryError) Unwrap() error\n```\n\n```go\ntype Syncer interface {\n\tPlugin\n\tSink(ctx context.Context, batch []models.Record) (err error)\n\n\t// Close will be called once after everything is done\n\tClose() error\n}\n```\nSyncer is a plugin that can be used to sync data from one source to another.\n\n","path":"github.com/raystack/meteor/plugins","name":"plugins","synopsis":"","isRedistributable":true}
