Documentation
¶
Index ¶
- Constants
- Variables
- func CSUUID(uuid string) (primitive.Binary, error)
- func Compile[T any](stmt *Statement, b Backend[T]) (T, error)
- func Execute[R any](ctx context.Context, stmt *Statement, e Executor[R]) (R, error)
- func HexToBase64(in string) []byte
- func LogDebug(format string, v ...any)
- func Map(d bson.D) bson.M
- type AnyBackend
- type AnyExecutor
- type Backend
- type BinaryExpr
- type ColumnExpr
- type Connector
- type Executor
- type Expr
- type FilterPredicate
- type FuncExpr
- type Join
- type ListExpr
- type LiteralExpr
- type LogicalExpr
- type MongoBackend
- type MongoConfig
- type MongoOption
- type MongoResult
- type OrderDirection
- type OrderItem
- type Parser
- type PartitionStyle
- type Plan
- type Projection
- type Query
- type QueryBuilder
- type RadixS3Client
- type RangeExpr
- type S3Backend
- type S3ClientAPI
- type S3Config
- type S3Object
- type S3Option
- type S3Query
- type StarExpr
- type Statement
- func (statement *Statement) Backend() AnyBackend
- func (statement *Statement) Build(target any) (*Query, error)
- func (statement *Statement) CSUUID(uuid string) (primitive.Binary, error)
- func (statement *Statement) Compile(b ...AnyBackend) (any, error)
- func (statement *Statement) Execute(ctx context.Context, executor ...AnyExecutor) (any, error)
- func (statement *Statement) HexToBase64(in string) []byte
- func (statement *Statement) Parse() (*Plan, error)
- func (statement *Statement) Stream(ctx context.Context, streamer ...Streamer) iter.Seq2[[]byte, error]
- func (statement *Statement) WithBackend(b AnyBackend) *Statement
- type Streamer
- type SubqueryExpr
- type TableRef
Constants ¶
const ( HivePartitioning = backend.HivePartitioning FlatPartitioning = backend.FlatPartitioning )
const ( Asc = backend.Asc Desc = backend.Desc )
Variables ¶
var ( NewMongoBackend = backend.NewMongoBackend WithMongoURI = backend.WithMongoURI WithMongoDatabase = backend.WithMongoDatabase WithMongoTimeout = backend.WithMongoTimeout WithMongoClient = backend.WithMongoClient WithMongoDB = backend.WithMongoDB NewS3Backend = backend.NewS3Backend NewRadixS3Client = backend.NewRadixS3Client WithBucket = backend.WithBucket WithBasePrefix = backend.WithBasePrefix WithPartitionStyle = backend.WithPartitionStyle WithPartitionKeys = backend.WithPartitionKeys WithDefaultPartitionKeys = backend.WithDefaultPartitionKeys WithAutoDetectPartitions = backend.WithAutoDetectPartitions WithMaxDateRangePartitions = backend.WithMaxDateRangePartitions WithS3Client = backend.WithS3Client WithEndpoint = backend.WithEndpoint WithRegion = backend.WithRegion WithCredentials = backend.WithCredentials WithAnonymous = backend.WithAnonymous WithUsePathStyle = backend.WithUsePathStyle WithHTTPTimeout = backend.WithHTTPTimeout WithDownloader = backend.WithDownloader WithUploader = backend.WithUploader WithPrefetchConcurrency = backend.WithPrefetchConcurrency )
Functions ¶
func CSUUID ¶
CSUUID is a package-level function that converts a UUID string to a MongoDB
Binary type using a specific reordering pattern. It removes any curly braces and hyphens from the UUID, then reorders the bytes according to the required format before converting to base64 and creating a Binary value.
func HexToBase64 ¶
HexToBase64 is a package-level function that converts a hexadecimal string
to its base64 encoded representation. If the hex decoding fails, it returns an empty byte slice and logs the error.
Types ¶
type AnyBackend ¶
type AnyBackend = backend.AnyBackend
Type aliases for backend adapter interfaces and implementations.
type AnyExecutor ¶
type AnyExecutor = backend.AnyExecutor
Type aliases for backend adapter interfaces and implementations.
type BinaryExpr ¶
type BinaryExpr = backend.BinaryExpr
Type aliases for Plan and abstract AST expression types defined in backend package.
type ColumnExpr ¶
type ColumnExpr = backend.ColumnExpr
Type aliases for Plan and abstract AST expression types defined in backend package.
type FilterPredicate ¶
type FilterPredicate = backend.FilterPredicate
Type aliases for backend adapter interfaces and implementations.
type LiteralExpr ¶
type LiteralExpr = backend.LiteralExpr
Type aliases for Plan and abstract AST expression types defined in backend package.
type LogicalExpr ¶
type LogicalExpr = backend.LogicalExpr
Type aliases for Plan and abstract AST expression types defined in backend package.
type MongoBackend ¶
type MongoBackend = backend.MongoBackend
Type aliases for backend adapter interfaces and implementations.
type MongoConfig ¶
type MongoConfig = backend.MongoConfig
Type aliases for backend adapter interfaces and implementations.
type MongoOption ¶
type MongoOption = backend.MongoOption
Type aliases for backend adapter interfaces and implementations.
type MongoResult ¶
type MongoResult = backend.MongoResult
Type aliases for backend adapter interfaces and implementations.
type OrderDirection ¶
type OrderDirection = backend.OrderDirection
Type aliases for Plan and abstract AST expression types defined in backend package.
type OrderItem ¶
Type aliases for Plan and abstract AST expression types defined in backend package.
type Parser ¶
type Parser struct{}
Parser parses SQL query strings into abstract, storage-agnostic Plan structures. It has zero dependencies on any database-specific driver (MongoDB, S3, etc.).
type PartitionStyle ¶
type PartitionStyle = backend.PartitionStyle
Type aliases for backend adapter interfaces and implementations.
type Projection ¶
type Projection = backend.Projection
Type aliases for Plan and abstract AST expression types defined in backend package.
type QueryBuilder ¶
type QueryBuilder = backend.QueryBuilder
Type aliases for backend adapter interfaces and implementations.
type RadixS3Client ¶
type RadixS3Client = backend.RadixS3Client
Type aliases for backend adapter interfaces and implementations.
type RangeExpr ¶
Type aliases for Plan and abstract AST expression types defined in backend package.
type S3ClientAPI ¶
type S3ClientAPI = backend.S3ClientAPI
Type aliases for backend adapter interfaces and implementations.
type Statement ¶
type Statement struct {
// contains filtered or unexported fields
}
Statement represents a SQL statement that can be parsed into an abstract Plan and compiled or executed across any backend implementing the adapter interfaces.
func NewStatement ¶
NewStatement creates a new Statement instance from a raw SQL query string and an optional backend interface.
func (*Statement) Backend ¶
func (statement *Statement) Backend() AnyBackend
Backend returns the currently attached backend adapter interface, if any.
func (*Statement) Build ¶
Build compiles the SQL statement into the target query structure using the attached backend's QueryBuilder interface. If no backend is attached, it defaults to using the MongoDB QueryBuilder.
func (*Statement) CSUUID ¶
CSUUID converts a UUID string to a MongoDB Binary type using a specific
reordering pattern. It removes any curly braces and hyphens from the UUID, then reorders the bytes according to the required format before converting to base64 and creating a Binary value.
func (*Statement) Compile ¶
Compile compiles the statement using the provided backend interface, or the statement's attached backend.
func (*Statement) Execute ¶
Execute executes the statement using the provided executor interface, or the statement's attached backend.
func (*Statement) HexToBase64 ¶
HexToBase64 converts a hexadecimal string to its base64 encoded representation.
If the hex decoding fails, it returns an empty byte slice and logs the error.
func (*Statement) Parse ¶
Parse parses the raw SQL statement into an abstract, storage-agnostic Plan.
func (*Statement) Stream ¶
func (statement *Statement) Stream(ctx context.Context, streamer ...Streamer) iter.Seq2[[]byte, error]
Stream streams data for the statement using the provided streamer interface, or the statement's attached backend.
func (*Statement) WithBackend ¶
WithBackend attaches a backend adapter interface to the statement.
type SubqueryExpr ¶
type SubqueryExpr = backend.SubqueryExpr
Type aliases for Plan and abstract AST expression types defined in backend package.