Help us shape the future of Go! Take the 2026 Go Developer Survey

sqlutil

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: Apache-2.0, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyLimitOffset

func ApplyLimitOffset(df *dataframe.DataFrame, limit, offset int64) (*dataframe.DataFrame, error)

ApplyLimitOffset applies LIMIT and OFFSET operations to a DataFrame.

func CreateEmptyDataFrame

func CreateEmptyDataFrame(template *dataframe.DataFrame) *dataframe.DataFrame

CreateEmptyDataFrame creates an empty DataFrame with the same schema as the template.

func CreateTestDataFrame

func CreateTestDataFrame(allocator memory.Allocator, config *TestDataFrameConfig) *dataframe.DataFrame

CreateTestDataFrame creates a standard test DataFrame with employee data. This consolidates the createTestDataFrame pattern found across multiple SQL test files.

func CreateTestDataFrameFromData

func CreateTestDataFrameFromData(allocator memory.Allocator, data map[string]interface{}) *dataframe.DataFrame

CreateTestDataFrameFromData creates a DataFrame from custom test data.

func SafeInt64ToInt

func SafeInt64ToInt(value int64) (int, error)

SafeInt64ToInt safely converts int64 to int with bounds checking.

Types

type BaseTranslator

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

BaseTranslator provides common SQL translation functionality.

func NewBaseTranslator

func NewBaseTranslator(allocator memory.Allocator) *BaseTranslator

NewBaseTranslator creates a new base translator with common functionality.

func (*BaseTranslator) ClearTables

func (bt *BaseTranslator) ClearTables()

ClearTables removes all registered tables.

func (*BaseTranslator) GetAllocator

func (bt *BaseTranslator) GetAllocator() memory.Allocator

GetAllocator returns the memory allocator.

func (*BaseTranslator) GetRegisteredTables

func (bt *BaseTranslator) GetRegisteredTables() []string

GetRegisteredTables returns the list of registered table names.

func (*BaseTranslator) GetTable

func (bt *BaseTranslator) GetTable(name string) (*dataframe.DataFrame, bool)

GetTable retrieves a registered table by name.

func (*BaseTranslator) HandleCommonErrors

func (bt *BaseTranslator) HandleCommonErrors(operation string, err error) error

HandleCommonErrors provides standardized error handling for SQL operations.

func (*BaseTranslator) RegisterTable

func (bt *BaseTranslator) RegisterTable(name string, df *dataframe.DataFrame)

RegisterTable registers a DataFrame with a table name.

func (*BaseTranslator) StandardizeColumns

func (bt *BaseTranslator) StandardizeColumns(columns []string) []string

StandardizeColumns standardizes column names according to SQL conventions.

func (*BaseTranslator) ValidateTableExists

func (bt *BaseTranslator) ValidateTableExists(tableName string) error

ValidateTableExists validates that a table is registered.

type TestDataFrameConfig

type TestDataFrameConfig struct {
	IncludeActive bool
	RowCount      int
	CustomData    map[string]interface{}
}

TestDataFrameConfig configures test DataFrame creation.

func DefaultTestDataFrameConfig

func DefaultTestDataFrameConfig() *TestDataFrameConfig

DefaultTestDataFrameConfig returns default test DataFrame configuration.

Jump to

Keyboard shortcuts

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