dynamo-browse/internal/dynamo-browse/models/queryexpr/values.go
Leon Mika a1717572c5
issue-22: Fixed expressions so that queries will be executed as queries (#25)
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.
2022-09-19 21:14:03 +10:00

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
}