Augmented expressions so that queries that can be executed as queries on DynamoDB can be done so. Also added an IR tree which is a simplified representation of the AST and will be used to plan the query.
29 lines
617 B
Go
29 lines
617 B
Go
package queryexpr
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"github.com/aws/aws-sdk-go-v2/service/dynamodb/types"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
func (a *astLiteralValue) dynamoValue() (types.AttributeValue, error) {
|
|
s, err := strconv.Unquote(a.StringVal)
|
|
if err != nil {
|
|
return nil, errors.Wrap(err, "cannot unquote string")
|
|
}
|
|
return &types.AttributeValueMemberS{Value: s}, nil
|
|
}
|
|
|
|
func (a *astLiteralValue) goValue() (any, error) {
|
|
s, err := strconv.Unquote(a.StringVal)
|
|
if err != nil {
|
|
return nil, errors.Wrap(err, "cannot unquote string")
|
|
}
|
|
return s, nil
|
|
}
|
|
|
|
func (a *astLiteralValue) String() string {
|
|
return a.StringVal
|
|
}
|