common

package
v0.1.1-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

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) []zap.Field

func AllStreamResponsesSuccessfull

func AllStreamResponsesSuccessfull[T StreamResponse](responses []T) bool

func AnnotateLoggerForUnaryCall

func AnnotateLoggerForUnaryCall(l *zap.Logger, method string, dsi *api_common.TDataSourceInstance) *zap.Logger

func AnnotateLoggerWithDataSourceInstance

func AnnotateLoggerWithDataSourceInstance(l *zap.Logger, dsi *api_common.TDataSourceInstance) *zap.Logger

func AnnotateLoggerWithMethod

func AnnotateLoggerWithMethod(l *zap.Logger, method string) *zap.Logger

func EndpointToString

func EndpointToString(ep *api_common.TEndpoint) string

func IsSuccess

func IsSuccess(apiErr *api_service_protos.TError) bool

func LogCloserError

func LogCloserError(logger *zap.Logger, closer io.Closer, msg string)

func MakeOptionalType

func MakeOptionalType(ydbType *Ydb.Type) *Ydb.Type

func MakePrimitiveType

func MakePrimitiveType(typeId Ydb.Type_PrimitiveTypeId) *Ydb.Type

func MakeTypedValue

func MakeTypedValue(ydbType *Ydb.Type, value any) *Ydb.TypedValue

func MustTimeToYDBType

func MustTimeToYDBType[OUT ydbTime](f func(t *time.Time) (OUT, error), t time.Time) OUT

func NewAPIErrorFromStdError

func NewAPIErrorFromStdError(err error) *api_service_protos.TError

func NewDefaultLogger

func NewDefaultLogger() *zap.Logger

func NewLoggerFromConfig

func NewLoggerFromConfig(cfg *config.TLoggerConfig) (*zap.Logger, error)

func NewSTDErrorFromAPIError

func NewSTDErrorFromAPIError(apiErr *api_service_protos.TError) error

func NewSuccess

func NewSuccess() *api_service_protos.TError

func NewTestLogger

func NewTestLogger(t *testing.T) *zap.Logger

func ReadResponsesToArrowRecords

func ReadResponsesToArrowRecords(responses []*api_service_protos.TReadSplitsResponse) ([]arrow.Record, error)

func SchemaToSelectWhatItems

func SchemaToSelectWhatItems(
	schema *api_service_protos.TSchema,
	whitelist map[string]struct{},
) *api_service_protos.TSelect_TWhat

func SelectToFields

func SelectToFields(slct *api_service_protos.TSelect) []zap.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 TimeToYDBDate

func TimeToYDBDate(t *time.Time) (uint16, error)

func TimeToYDBDatetime

func TimeToYDBDatetime(t *time.Time) (uint32, error)

func TimeToYDBTimestamp

func TimeToYDBTimestamp(t *time.Time) (uint64, error)

func YdbTypeToYdbPrimitiveTypeID

func YdbTypeToYdbPrimitiveTypeID(ydbType *Ydb.Type) (Ydb.Type_PrimitiveTypeId, error)

func YdbTypesToArrowBuilders

func YdbTypesToArrowBuilders(ydbTypes []*Ydb.Type, arrowAllocator memory.Allocator) ([]array.Builder, error)

Types

type ArrowArrayType

type ArrowArrayType[VT ValueType] interface {
	*array.Boolean |
		*array.Int8 | *array.Int16 | *array.Int32 | *array.Int64 |
		*array.Uint8 | *array.Uint16 | *array.Uint32 | *array.Uint64 |
		*array.Float32 | *array.Float64 |
		*array.String | *array.Binary

	Len() int
	Value(int) VT
	IsNull(int) bool
}

type ArrowBuilder

type ArrowBuilder[VT ValueType] interface {
	AppendNull()
	Append(value VT)
}

type QueryLogger

type QueryLogger struct {
	*zap.Logger
	// contains filtered or unexported fields
}

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 *zap.Logger) QueryLogger

type ValueType

type ValueType interface {
	bool |
		int8 | int16 | int32 | int64 |
		uint8 | uint16 | uint32 | uint64 |
		float32 | float64 |
		string | []byte |
		time.Time
}

Jump to

Keyboard shortcuts

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