data

package
v0.22.3 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RFC3339MicroNoTZ = "2006-01-02T15:04:05.999999"
	RFC3339MicroTZ   = "2006-01-02T15:04:05.999999Z07:00"
)

Variables

This section is empty.

Functions

func ConvertSQLServerUUID added in v0.5.0

func ConvertSQLServerUUID(sqlBytes []byte) []byte

func GeneratePKCS8StringSupress added in v0.17.0

func GeneratePKCS8StringSupress(key *rsa.PrivateKey) string

func GetMVRVars

func GetMVRVars(prefix string) map[string]string

func ParseAndExecuteTemplate added in v0.9.0

func ParseAndExecuteTemplate(data []byte, config *StreamConfig) ([]byte, error)

func ParsePEMPrivateKey added in v0.17.0

func ParsePEMPrivateKey(pemKey string) (*rsa.PrivateKey, error)

func SortKeys added in v0.8.0

func SortKeys(params []string)

func TypeAlias added in v0.19.0

func TypeAlias(columnType string) string

TypeAlias corrects for the various ways that Postgres types are named the goal is to only have the name column from this table https://www.postgresql.org/docs/current/datatype.html#DATATYPE-TABLE

Types

type Batch

type Batch struct {
	Rows [][]any
}

type BatchWriter added in v0.13.0

type BatchWriter interface {
	WriteBatch(batch Batch) error
}

type Column

type Column struct {
	Name         string `json:"name" yaml:"name"`
	DatabaseType string `json:"database_type" yaml:"database_type"`
	Type         string `json:"type" yaml:"type"`
	Length       int64  `json:"length,omitempty" yaml:"length,omitempty"`
	Nullable     bool   `json:"nullable" yaml:"nullable"`
	Position     int    `json:"position" yaml:"position"`
	Scale        int64  `json:"scale,omitempty" yaml:"scale,omitempty"`
	Precision    int64  `json:"precision,omitempty" yaml:"precision,omitempty"`
}

func OverrideColumns

func OverrideColumns(original []Column, overrides []Column) []Column

type DBExec added in v0.22.3

type DBExec interface {
	ExecuteCommand(ctx context.Context, sql_command string) (string, error)
}

type DBReaderConn added in v0.1.0

type DBReaderConn interface {
	CreateDataStream(ctx context.Context, cs *url.URL, config *StreamConfig) (*DataStream, error)
	ExecuteDataStream(ctx context.Context, ds *DataStream, config *StreamConfig) error
	Close() error
}

type DataStream

type DataStream struct {
	TotalRows   int
	Mux         sync.Mutex
	BatchChan   chan Batch
	BatchSize   int
	Columns     []Column
	DestColumns []Column
}

func (*DataStream) BatchesToWriter

func (ds *DataStream) BatchesToWriter(ctx context.Context, writer BatchWriter) error

type DataWriter

type DataWriter interface {
	CreateBatchWriter() BatchWriter
	Flush() error
	Close() error
}

type MultiStreamConfig added in v0.12.0

type MultiStreamConfig struct {
	StreamConfig `json:",inline" yaml:",inline"`
	Tables       []StreamConfig `json:"tables" yaml:"tables"`
}

type Param added in v0.8.0

type Param struct {
	Value string `json:"value" yaml:"value"`
	Type  string `json:"type" yaml:"type"`
}

type RawStreamConfig added in v0.11.0

type RawStreamConfig struct {
	Filename  TemplateString `yaml:"filename"`
	BatchSize int            `yaml:"batch_size"`
}

type StreamConfig

type StreamConfig struct {
	StreamName  string           `json:"stream_name,omitempty" yaml:"stream_name,omitempty"`
	Filename    string           `json:"filename,omitempty" yaml:"filename,omitempty"`
	Format      string           `json:"format,omitempty" yaml:"format,omitempty"`
	SQL         string           `json:"sql,omitempty" yaml:"sql,omitempty"`
	Compression string           `json:"compression,omitempty" yaml:"compression,omitempty"`
	Columns     []Column         `json:"columns,omitempty" yaml:"columns,omitempty"`
	Params      map[string]Param `json:"params,omitempty" yaml:"params,omitempty"`
	ParamKeys   []string
	BatchSize   int `json:"batch_size,omitempty" yaml:"batch_size,omitempty"`
	BatchCount  int `json:"batch_count,omitempty" yaml:"batch_count,omitempty"`
}

func BuildConfig added in v0.9.0

func BuildConfig(data []byte, cliArgs *StreamConfig) (*StreamConfig, error)

func NewStreamConfigFromYaml

func NewStreamConfigFromYaml(data []byte) (*StreamConfig, error)

func (*StreamConfig) GetBatchCount added in v0.13.0

func (sc *StreamConfig) GetBatchCount() int

func (*StreamConfig) GetBatchSize added in v0.10.0

func (sc *StreamConfig) GetBatchSize() int

func (*StreamConfig) OverrideValues added in v0.9.0

func (sc *StreamConfig) OverrideValues(cliArgs *StreamConfig)

func (*StreamConfig) Validate added in v0.9.0

func (sc *StreamConfig) Validate() error

type TemplateString added in v0.11.0

type TemplateString struct {
	Raw string
}

func (*TemplateString) UnmarshalYAML added in v0.11.0

func (t *TemplateString) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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