Files
fn-serverless/examples/postgres
James Jeffrey c7f3066c75 Update references remove refs to treeder oracle funcy (#376)
* Remove lots of refs to iron and funcy oracle etc..

* more ref replacements

* Replacing more refs. Treeder

* Use Fn not FN
2017-09-29 16:22:15 -07:00
..
2017-01-30 09:06:31 -08:00
2017-09-06 07:24:50 -07:00
2017-01-30 09:06:31 -08:00
2017-01-30 09:06:31 -08:00

Postgres INSERT/SELECT Function Image

This function executes an INSERT or SELECT against a table in a given postgres server.

# Create your func.yaml file
fn init --name func-postgres
# Build the function
fn build
# Test it
./test.sh
# Push it to Docker Hub
fn push
# Create routes to this function on Fn
fn apps create <YOUR_APP> --config SERVER=<POSTGRES>
fn routes create --config TABLE=<TABLE_NAME> --config COMMAND=INSERT <YOUR_APP> /<TABLE_NAME>/insert
fn routes create --config TABLE=<TABLE_NAME> --config COMMAND=SELECT <YOUR_APP> /<TABLE_NAME>/select

Now you can call your function on Fn:

echo <JSON_RECORD> | fn call /<YOUR_APP>/<TABLE_NAME>/insert
echo <JSON_QUERY> | fn call /<YOUR_APP>/<TABLE_NAME>/select