Documentation
¶
Index ¶
- Constants
- Variables
- func NewSource() sdk.Source
- func Specification() sdk.Specification
- type BurstConfig
- type CollectionConfig
- type Config
- type FormatConfig
- type Source
- func (s *Source) Ack(ctx context.Context, position opencdc.Position) error
- func (s *Source) Configure(ctx context.Context, cfg config.Config) error
- func (s *Source) Open(_ context.Context, _ opencdc.Position) error
- func (s *Source) Parameters() config.Parameters
- func (s *Source) Read(ctx context.Context) (opencdc.Record, error)
- func (s *Source) Teardown(_ context.Context) error
Constants ¶
View Source
const ( FormatTypeRaw = "raw" FormatTypeStructured = "structured" FormatTypeFile = "file" FormatTypeFHIR = "fhir" FormatTypeHL7 = "hl7" )
View Source
const ( TypeName = "name" TypeEmail = "email" TypeEmployeeID = "employeeid" TypeSSN = "ssn" TypeCreditCard = "creditcard" TypeOrderNum = "ordernumber" )
Add new constants for specific string types
View Source
const ( ConfigBurstGenerateTime = "burst.generateTime" ConfigBurstSleepTime = "burst.sleepTime" ConfigCollectionsFormatOptions = "collections.*.format.options.*" ConfigCollectionsFormatOptionsPath = "collections.*.format.options.path" ConfigCollectionsFormatType = "collections.*.format.type" ConfigCollectionsOperations = "collections.*.operations" ConfigFormatOptions = "format.options.*" ConfigFormatOptionsPath = "format.options.path" ConfigFormatType = "format.type" ConfigOperations = "operations" ConfigRate = "rate" ConfigReadTime = "readTime" ConfigRecordCount = "recordCount" )
Variables ¶
View Source
var Connector = sdk.Connector{ NewSpecification: Specification, NewSource: NewSource, NewDestination: nil, }
Functions ¶
func Specification ¶
func Specification() sdk.Specification
Specification returns the Plugin's Specification.
Types ¶
type BurstConfig ¶
type BurstConfig struct {
// The time the generator "sleeps" between bursts.
SleepTime time.Duration `json:"sleepTime"`
// The amount of time the generator is generating records in a burst. Has an
// effect only if `burst.sleepTime` is set.
GenerateTime time.Duration `json:"generateTime" default:"1s"`
}
type CollectionConfig ¶
type CollectionConfig struct {
// Comma separated list of record operations to generate. Allowed values are
// "create", "update", "delete", "snapshot".
Operations []string `json:"operations" default:"create" validate:"required"`
Format FormatConfig `json:"format"`
}
func (CollectionConfig) SdkOperations ¶
func (c CollectionConfig) SdkOperations() []opencdc.Operation
func (CollectionConfig) Validate ¶
func (c CollectionConfig) Validate() error
type Config ¶
type Config struct {
Burst BurstConfig `json:"burst"`
// Number of records to be generated (0 means infinite).
RecordCount int `json:"recordCount" validate:"gt=-1"`
// The time it takes to 'read' a record.
// Deprecated: use `rate` instead.
ReadTime time.Duration `json:"readTime"`
// The maximum rate in records per second, at which records are generated (0
// means no rate limit).
Rate float64 `json:"rate"`
// Configuration for default collection (i.e. records without a collection).
// Kept for backwards compatibility.
CollectionConfig
Collections map[string]CollectionConfig `json:"collections"`
}
func (Config) GetCollectionConfigs ¶
func (c Config) GetCollectionConfigs() map[string]CollectionConfig
type FormatConfig ¶
type FormatConfig struct {
// The format of the generated payload data (raw, structured, file, fhir, hl7).
Type string `json:"type" validate:"inclusion=raw|structured|file|fhir|hl7"`
// The options for the `raw` and `structured` format types. It accepts pairs
// of field names and field types, where the type can be one of: `int`, `string`, `time`, `bool`, `duration`,
// `name`, `email`, `employeeid`, `ssn`, `creditcard`, `ordernumber`.
Options map[string]string `json:"options"`
// Path to the input file (only applicable if the format type is `file`).
FileOptionsPath string `json:"options.path"`
}
func (FormatConfig) Validate ¶
func (c FormatConfig) Validate() error
type Source ¶
type Source struct {
sdk.UnimplementedSource
// contains filtered or unexported fields
}
Source connector
func (*Source) Parameters ¶
func (s *Source) Parameters() config.Parameters
Click to show internal directories.
Click to hide internal directories.