Documentation ¶
Overview ¶
Package utils contains various helpers and utility functions
Index ¶
- Variables
- func APIErrorToLogFields(apiErr *api_service_protos.TError) []log.Field
- func AnnotateLogger(logger log.Logger, method string, dsi *api_common.TDataSourceInstance) log.Logger
- func DumpProtoMessageToJSON(msg proto.Message, stream io.Writer) error
- func DumpReadSplitsResponse(logger log.Logger, resp *api_service_protos.TReadSplitsResponse)
- func EndpointToString(ep *api_common.TEndpoint) string
- func IsSuccess(apiErr *api_service_protos.TError) bool
- func LogCloserError(logger log.Logger, closer io.Closer, msg string)
- func MakeTestSplit() *api_service_protos.TSplit
- func NewAPIErrorFromStdError(err error) *api_service_protos.TError
- func NewColumnExpression(name string) *api_service_protos.TExpression
- func NewDefaultLogger() (log.Logger, error)
- func NewDefaultWhat() *api_service_protos.TSelect_TWhat
- func NewInt32ValueExpression(val int32) *api_service_protos.TExpression
- func NewLoggerFromConfig(cfg *config.TLoggerConfig) (log.Logger, error)
- func NewPrimitiveType(t Ydb.Type_PrimitiveTypeId) *Ydb.Type
- func NewSTDErrorFromAPIError(apiErr *api_service_protos.TError) error
- func NewSuccess() *api_service_protos.TError
- func NewTestLogger(t *testing.T) log.Logger
- func NewTextValueExpression(val string) *api_service_protos.TExpression
- func NewUint64ValueExpression(val uint64) *api_service_protos.TExpression
- func SelectToFields(slct *api_service_protos.TSelect) []log.Field
- func SelectWhatToArrowSchema(selectWhat *api_service_protos.TSelect_TWhat) (*arrow.Schema, error)
- func SelectWhatToYDBTypes(selectWhat *api_service_protos.TSelect_TWhat) ([]*Ydb.Type, error)
- func TimeToYDBDate(t *time.Time) (uint16, error)
- func TimeToYDBDatetime(t *time.Time) (uint32, error)
- func TimeToYDBTimestamp(t *time.Time) (uint64, error)
- func YdbTypeToYdbPrimitiveTypeID(ydbType *Ydb.Type) (Ydb.Type_PrimitiveTypeId, error)
- func YdbTypesToArrowBuilders(ydbTypes []*Ydb.Type, arrowAllocator memory.Allocator) ([]array.Builder, error)
- type Acceptor
- type ArrowBuilder
- type BoolConverter
- type BytesConverter
- type Counter
- type DataConverter
- type DateConverter
- type DateToStringConverter
- type DatetimeConverter
- type DatetimeToStringConverter
- type Float32Converter
- type Float64Converter
- type Int16Converter
- type Int32Converter
- type Int64Converter
- type Int8Converter
- type QueryLogger
- type QueryLoggerFactory
- type RowTransformer
- type RowTransformerDefault
- type StringConverter
- type StringToBytesConverter
- type TimestampConverter
- type TimestampToStringConverter
- type TypeMapper
- type Uint16Converter
- type Uint32Converter
- type Uint64Converter
- type Uint8Converter
- type ValueConverter
- type ValueType
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTableDoesNotExist = fmt.Errorf("table does not exist") ErrDataSourceNotSupported = fmt.Errorf("data source not supported") ErrDataTypeNotSupported = fmt.Errorf("data type not supported") ErrMethodNotSupported = fmt.Errorf("method not supported") ErrReadLimitExceeded = fmt.Errorf("read limit exceeded") ErrInvalidRequest = fmt.Errorf("invalid request") ErrValueOutOfTypeBounds = fmt.Errorf("value is out of possible range of values for the type") ErrUnimplemented = fmt.Errorf("unimplemented") ErrUnimplementedTypedValue = fmt.Errorf("unimplemented typed value") ErrUnimplementedExpression = fmt.Errorf("unimplemented expression") ErrUnsupportedExpression = fmt.Errorf("expression is not supported") ErrUnimplementedOperation = fmt.Errorf("unimplemented operation") ErrUnimplementedPredicateType = fmt.Errorf("unimplemented predicate type") ErrInvariantViolation = fmt.Errorf("implementation error (invariant violation)") ErrUnimplementedArithmeticalExpression = fmt.Errorf("unimplemented arithmetical expression") ErrEmptyTableName = fmt.Errorf("empty table name") ErrPageSizeExceeded = fmt.Errorf("page size exceeded, check service configuration") )
Functions ¶
func APIErrorToLogFields ¶
func APIErrorToLogFields(apiErr *api_service_protos.TError) []log.Field
func AnnotateLogger ¶
func AnnotateLogger(logger log.Logger, method string, dsi *api_common.TDataSourceInstance) log.Logger
func DumpProtoMessageToJSON ¶
func DumpReadSplitsResponse ¶
func DumpReadSplitsResponse(logger log.Logger, resp *api_service_protos.TReadSplitsResponse)
func EndpointToString ¶
func EndpointToString(ep *api_common.TEndpoint) string
func IsSuccess ¶
func IsSuccess(apiErr *api_service_protos.TError) bool
func MakeTestSplit ¶
func MakeTestSplit() *api_service_protos.TSplit
func NewAPIErrorFromStdError ¶
func NewAPIErrorFromStdError(err error) *api_service_protos.TError
func NewColumnExpression ¶
func NewColumnExpression(name string) *api_service_protos.TExpression
func NewDefaultLogger ¶
func NewDefaultWhat ¶
func NewDefaultWhat() *api_service_protos.TSelect_TWhat
NewDefaultWhat generates default What field with a pair of columns
func NewInt32ValueExpression ¶
func NewInt32ValueExpression(val int32) *api_service_protos.TExpression
func NewLoggerFromConfig ¶
func NewLoggerFromConfig(cfg *config.TLoggerConfig) (log.Logger, error)
func NewPrimitiveType ¶
func NewPrimitiveType(t Ydb.Type_PrimitiveTypeId) *Ydb.Type
func NewSTDErrorFromAPIError ¶
func NewSTDErrorFromAPIError(apiErr *api_service_protos.TError) error
func NewSuccess ¶
func NewSuccess() *api_service_protos.TError
func NewTextValueExpression ¶
func NewTextValueExpression(val string) *api_service_protos.TExpression
func NewUint64ValueExpression ¶
func NewUint64ValueExpression(val uint64) *api_service_protos.TExpression
func SelectToFields ¶
func SelectToFields(slct *api_service_protos.TSelect) []log.Field
func SelectWhatToArrowSchema ¶
func SelectWhatToArrowSchema(selectWhat *api_service_protos.TSelect_TWhat) (*arrow.Schema, error)
func SelectWhatToYDBTypes ¶
func SelectWhatToYDBTypes(selectWhat *api_service_protos.TSelect_TWhat) ([]*Ydb.Type, error)
func YdbTypeToYdbPrimitiveTypeID ¶
func YdbTypeToYdbPrimitiveTypeID(ydbType *Ydb.Type) (Ydb.Type_PrimitiveTypeId, error)
Types ¶
type Acceptor ¶
Acceptor is a fundamental type class that is used during data extraction from the data source
type ArrowBuilder ¶
type ArrowBuilder[VT ValueType] interface { AppendNull() Append(value VT) }
type BoolConverter ¶
type BoolConverter struct{}
type BytesConverter ¶
type BytesConverter struct{}
type Counter ¶
type Counter[T number] struct {
// contains filtered or unexported fields
}
func NewCounter ¶
func NewCounter[T number]() *Counter[T]
type DataConverter ¶
type DataConverter struct{}
DataConverter should be used only from unit tests
func (DataConverter) RowsToColumnBlocks ¶
func (dc DataConverter) RowsToColumnBlocks(input [][]any, rowsPerBlock int) [][][]any
type DateConverter ¶
type DateConverter struct{}
type DateToStringConverter ¶
type DateToStringConverter struct{}
type DatetimeConverter ¶
type DatetimeConverter struct{}
type DatetimeToStringConverter ¶
type DatetimeToStringConverter struct{}
type Float32Converter ¶
type Float32Converter struct{}
type Float64Converter ¶
type Float64Converter struct{}
type Int16Converter ¶
type Int16Converter struct{}
type Int32Converter ¶
type Int32Converter struct{}
type Int64Converter ¶
type Int64Converter struct{}
type Int8Converter ¶
type Int8Converter struct{}
type QueryLogger ¶
func (*QueryLogger) Dump ¶
func (ql *QueryLogger) Dump(query string, args ...any)
type QueryLoggerFactory ¶
type QueryLoggerFactory struct {
// contains filtered or unexported fields
}
func NewQueryLoggerFactory ¶
func NewQueryLoggerFactory(cfg *config.TLoggerConfig) QueryLoggerFactory
func (*QueryLoggerFactory) Make ¶
func (f *QueryLoggerFactory) Make(logger log.Logger) QueryLogger
type RowTransformer ¶
type RowTransformer[T Acceptor] interface { AppendToArrowBuilders(builders []array.Builder) error SetAcceptors(acceptors []T) GetAcceptors() []T }
RowTransformer is a container for values taken extracted from a single table row. RowTransformer also knows how to convert them into columnar reprsentation with Arrow builders.
func NewRowTransformer ¶
type RowTransformerDefault ¶
type RowTransformerDefault[T Acceptor] struct { // contains filtered or unexported fields }
func (*RowTransformerDefault[T]) AppendToArrowBuilders ¶
func (rt *RowTransformerDefault[T]) AppendToArrowBuilders(builders []array.Builder) error
func (*RowTransformerDefault[T]) GetAcceptors ¶
func (rt *RowTransformerDefault[T]) GetAcceptors() []T
func (*RowTransformerDefault[T]) SetAcceptors ¶
func (rt *RowTransformerDefault[T]) SetAcceptors(acceptors []T)
type StringConverter ¶
type StringConverter struct{}
type StringToBytesConverter ¶
type StringToBytesConverter struct{}
type TimestampConverter ¶
type TimestampConverter struct{}
type TimestampToStringConverter ¶
type TimestampToStringConverter struct{}
type TypeMapper ¶
type TypeMapper interface {
SQLTypeToYDBColumn(columnName, typeName string, rules *api_service_protos.TTypeMappingSettings) (*Ydb.Column, error)
}
type Uint16Converter ¶
type Uint16Converter struct{}
type Uint32Converter ¶
type Uint32Converter struct{}
type Uint64Converter ¶
type Uint64Converter struct{}
type Uint8Converter ¶
type Uint8Converter struct{}
type ValueConverter ¶
Click to show internal directories.
Click to hide internal directories.