Categorygithub.com/WinterYukky/aws-lambda-sql-runtime
modulepackage
0.1.2
Repository: https://github.com/winteryukky/aws-lambda-sql-runtime.git
Documentation: pkg.go.dev

# README

AWS Lambda SQL Runtime

This is one of the AWS Lambda crazy runtime series that can execute SQL on AWS Lambda.

test status MIT license

execute image

Install

  1. Download runtime.zip from latest release.
  2. Upload runtime.zip as Lambda layer to AWS Lambda.
  3. Add the layer to your lambda function.

Example

Hello World

This runtime returns last query result as json. Next code is simple example.

SELECT
    200 statusCode,
    'Hello from SQL runtime!' body;

The SQL returns this response.

{
  "body": "Hello from SQL runtime!",
  "statusCode": 200
}

Logging

print function logging and return the argument. Next code is example of using print.

SELECT print('Hello from SQL runtime!');

The SQL output this log.

START RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Version: $LATEST
Hello from SQL runtime!
END RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
REPORT RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx	Duration: 109.83 ms	Billed Duration: 203 ms	Memory Size: 128 MB	Max Memory Used: 24 MB	Init Duration: 93.02 ms	

Event

event function returns the event value of argument key. Next code is example of using event.

SELECT print(event(''));
SELECT event('key1') key1, event('key2') key2; 

event json

{
  "key1": "value1",
  "key2": "value2",
  "key3": "value3"
}

The SQL returns this response.

{
  "key1": "value1",
  "key2": "value2"
}

And output this log.

START RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Version: $LATEST
{"key1":"value1","key2":"value2","key3":"value3"}
END RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
REPORT RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx	Duration: 133.09 ms	Billed Duration: 222 ms	Memory Size: 128 MB	Max Memory Used: 24 MB	Init Duration: 88.90 ms	

# Packages

No description provided by the author

# Structs

No description provided by the author