Documentation
¶
Index ¶
- func DeleteInTx(tx Execer, table string, columns []string, rows [][]interface{}) error
- func InsertInTx(tx Execer, table string, columns []string, rows [][]interface{}) error
- func QuoteIdent(s string) string
- func QuoteIdentList(columns []string) string
- func UpdateInTx(tx Execer, table string, columns []string, rows [][]interface{}) error
- type DB
- type Execer
- type Sinker
- func (s *Sinker) Close() error
- func (s *Sinker) DatabaseName() string
- func (s *Sinker) DatabaseType() string
- func (s *Sinker) ExecContext(ctx context.Context, query string) error
- func (s *Sinker) Migrate(ctx context.Context) error
- func (s *Sinker) Query(query string, limit int) ([]string, []map[string]any, error)
- func (s *Sinker) QueryTables() ([]string, error)
- func (s *Sinker) Truncate(ctx context.Context, tables []string) error
- func (s *Sinker) Write(ctx context.Context, ops []core.Sink) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteInTx ¶
DeleteInTx deletes rows from a table within a transaction.
func InsertInTx ¶
InsertInTx inserts rows into a table within a transaction.
func QuoteIdent ¶
func QuoteIdentList ¶
Types ¶
type DB ¶
DB is a wrapper around github.com/cnlangzi/sqlite.DB providing read/write separation and migration support.
type Sinker ¶
type Sinker struct {
// contains filtered or unexported fields
}
Sinker implements sinker.Sinker for SQLite.
func (*Sinker) DatabaseName ¶
DatabaseName returns the database name.
func (*Sinker) DatabaseType ¶
DatabaseType returns the database type.
func (*Sinker) ExecContext ¶
ExecContext executes a raw SQL query
func (*Sinker) Migrate ¶
Migrate runs the migration for this sinker's database. It re-discovers and re-applies migrations from the configured migrations path.
func (*Sinker) Query ¶
Query executes a read-only query and returns columns and results. Uses the existing Reader connection instead of creating a temporary one. Returns columns in SQLite table order (not alphabetically sorted). Time columns are automatically formatted to "2006-01-02 15:04:05" via types.Codec.
func (*Sinker) QueryTables ¶
QueryTables returns the list of user tables in the sink database. Uses the existing Reader connection instead of creating a temporary one.