Documentation
¶
Overview ¶
Package jmespath evaluates JSON queries with optional Powertools functions.
Index ¶
- Constants
- func ExtractDataFromEnvelope(data any, envelope string, options ...Option) (any, error)
- func PurgeCache()
- func Search(source string, data any, options ...Option) (any, error)
- type Argument
- type Error
- type ErrorKind
- type Expression
- type ExpressionReference
- type Function
- type Option
- type Type
Constants ¶
const ( APIGatewayREST = "powertools_json(body)" APIGatewayHTTP = "powertools_json(body)" SQS = "Records[*].powertools_json(body)" SNS = "Records[0].Sns.Message | powertools_json(@)" EventBridge = "detail" CloudWatchEventsScheduled = "detail" KinesisDataStream = "Records[*].kinesis.powertools_json(powertools_base64(data))" CloudWatchLogs = "awslogs.powertools_base64_gzip(data) | powertools_json(@).logEvents[*]" S3SNSSQS = "Records[*].powertools_json(body).powertools_json(Message).Records[0]" S3SQS = "Records[*].powertools_json(body).Records[0]" S3SNSKinesisFirehose = "records[*].powertools_json(powertools_base64(data)).powertools_json(Message).Records[0]" S3KinesisFirehose = "records[*].powertools_json(powertools_base64(data)).Records[0]" S3EventBridgeSQS = "Records[*].powertools_json(body).detail" )
Built-in envelopes match all thirteen constants in TypeScript v2.35.0.
Variables ¶
This section is empty.
Functions ¶
func ExtractDataFromEnvelope ¶
ExtractDataFromEnvelope enables Powertools functions when options are omitted. Explicit options replace that default, following the reference helper.
func PurgeCache ¶
func PurgeCache()
PurgeCache removes cached syntax trees; already compiled expressions remain valid.
Types ¶
type ErrorKind ¶
type ErrorKind string
ErrorKind classifies failures without relying on engine error text.
type Expression ¶
type Expression struct {
// contains filtered or unexported fields
}
Expression is immutable and reusable across goroutines. Custom functions must be concurrency-safe and must not mutate or retain their input values.
func Compile ¶
func Compile(source string, options ...Option) (*Expression, error)
Compile prepares an expression. Standard functions are enabled by default; use WithPowertoolsFunctions for JSON, Base64 and gzip decoding.
func MustCompile ¶
func MustCompile(source string, options ...Option) *Expression
type ExpressionReference ¶
type Option ¶
type Option func(functionTable) error
func WithFunctions ¶
WithFunctions snapshots definitions and allows overriding built-in functions.
func WithPowertoolsFunctions ¶
func WithPowertoolsFunctions() Option
WithPowertoolsFunctions enables the reference JSON, Base64 and gzip functions. Gzip inputs are fully buffered, matching the reference; bound untrusted inputs at the application boundary. Base64 uses Commons validation before decoding.
type Type ¶
const ( Number Type = engine.JpNumber String Type = engine.JpString Array Type = engine.JpArray Object Type = engine.JpObject ArrayNumber Type = engine.JpArrayNumber ArrayString Type = engine.JpArrayString Expref Type = engine.JpExpref Any Type = engine.JpAny Boolean Type = "boolean" Null Type = "null" )