sqlbuilder

package
v1.1.0-beta.0...-6d74071 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDeleteSQL

func BuildDeleteSQL(tbl *cache.PhysicalTable, rows [][]types.Datum, expire time.Time) (string, error)

BuildDeleteSQL builds a delete SQL

func FormatSQLDatum

func FormatSQLDatum(d types.Datum, ft *types.FieldType) (string, error)

FormatSQLDatum formats the datum to a value string in sql

Types

type SQLBuilder

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

SQLBuilder is used to build SQLs for TTL

func NewSQLBuilder

func NewSQLBuilder(tbl *cache.PhysicalTable) *SQLBuilder

NewSQLBuilder creates a new TTLSQLBuilder

func (*SQLBuilder) Build

func (b *SQLBuilder) Build() (string, error)

Build builds the final sql

func (*SQLBuilder) WriteCommonCondition

func (b *SQLBuilder) WriteCommonCondition(cols []*model.ColumnInfo, op string, dp []types.Datum) error

WriteCommonCondition writes a new condition

func (*SQLBuilder) WriteDelete

func (b *SQLBuilder) WriteDelete() error

WriteDelete writes a delete statement without any condition

func (*SQLBuilder) WriteExpireCondition

func (b *SQLBuilder) WriteExpireCondition(expire time.Time) error

WriteExpireCondition writes a condition with the time column

func (*SQLBuilder) WriteInCondition

func (b *SQLBuilder) WriteInCondition(cols []*model.ColumnInfo, dps ...[]types.Datum) error

WriteInCondition writes an IN condition

func (*SQLBuilder) WriteLimit

func (b *SQLBuilder) WriteLimit(n int) error

WriteLimit writes the limit

func (*SQLBuilder) WriteOrderBy

func (b *SQLBuilder) WriteOrderBy(cols []*model.ColumnInfo, desc bool) error

WriteOrderBy writes order by

func (*SQLBuilder) WriteSelect

func (b *SQLBuilder) WriteSelect() error

WriteSelect writes a select statement to select key columns without any condition

type ScanQueryGenerator

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

ScanQueryGenerator generates SQLs for scan task

func NewScanQueryGenerator

func NewScanQueryGenerator(tbl *cache.PhysicalTable, expire time.Time,
	rangeStart, rangeEnd []types.Datum) (*ScanQueryGenerator, error)

NewScanQueryGenerator creates a new ScanQueryGenerator

func (*ScanQueryGenerator) IsExhausted

func (g *ScanQueryGenerator) IsExhausted() bool

IsExhausted returns whether the generator is exhausted

func (*ScanQueryGenerator) NextSQL

func (g *ScanQueryGenerator) NextSQL(continueFromResult [][]types.Datum, nextLimit int) (string, error)

NextSQL creates next sql of the scan task

Jump to

Keyboard shortcuts

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