batchsql

package
v1.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchSQLSource

type BatchSQLSource struct {
	// contains filtered or unexported fields
}

BatchSQLSource implements the hermod.Source interface for scheduled SQL queries.

func NewBatchSQLSource

func NewBatchSQLSource(dbProvider DBProvider, config Config) *BatchSQLSource

NewBatchSQLSource creates a new BatchSQLSource.

func (*BatchSQLSource) Ack

func (s *BatchSQLSource) Ack(ctx context.Context, msg hermod.Message) error

Ack moves the cursor to the acknowledged row's watermark — before releasing the message, whose metadata carries it.

func (*BatchSQLSource) Close

func (s *BatchSQLSource) Close() error

Close stops the cron scheduler and releases resources.

func (*BatchSQLSource) GetState

func (s *BatchSQLSource) GetState() map[string]string

GetState returns the current state for persistence.

func (*BatchSQLSource) Ping

func (s *BatchSQLSource) Ping(ctx context.Context) error

Ping checks if the schedule is valid.

func (*BatchSQLSource) Read

Read blocks until the next batch of results is available.

func (*BatchSQLSource) Sample

func (s *BatchSQLSource) Sample(ctx context.Context, table string) (hermod.Message, error)

Sample fetches a single record from the specified table for preview.

func (*BatchSQLSource) SetLogger

func (s *BatchSQLSource) SetLogger(logger hermod.Logger)

SetLogger sets the logger for the source.

func (*BatchSQLSource) SetState

func (s *BatchSQLSource) SetState(state map[string]string)

SetState sets the initial state for incremental tracking.

type Config

type Config struct {
	SourceID          string `json:"source_id"`
	Cron              string `json:"cron"`
	Queries           string `json:"queries"`
	IncrementalColumn string `json:"incremental_column"`
}

Config defines the configuration for BatchSQLSource.

type DBProvider

type DBProvider interface {
	GetOrOpenDBByID(ctx context.Context, id string) (*sql.DB, string, error)
}

DBProvider defines the interface for obtaining database connections.

Jump to

Keyboard shortcuts

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