github.com/iron-io/functions@v0.0.0-20180820112432-d59d7d1c40b2/examples/postgres/README.md (about) 1 # Postgres INSERT/SELECT Function Image 2 3 This function executes an INSERT or SELECT against a table in a given postgres server. 4 5 ``` 6 # Create your func.yaml file 7 fn init <YOUR_DOCKERHUB_USERNAME>/func-postgres 8 # Build the function 9 fn build 10 # Test it 11 ./test.sh 12 # Push it to Docker Hub 13 fn push 14 # Create routes to this function on IronFunctions 15 fn apps create <YOUR_APP> --config SERVER=<POSTGRES> 16 fn routes create --config TABLE=<TABLE_NAME> --config COMMAND=INSERT <YOUR_APP> /<TABLE_NAME>/insert 17 fn routes create --config TABLE=<TABLE_NAME> --config COMMAND=SELECT <YOUR_APP> /<TABLE_NAME>/select 18 ``` 19 20 Now you can call your function on IronFunctions: 21 22 ``` 23 echo <JSON_RECORD> | fn call /<YOUR_APP>/<TABLE_NAME>/insert 24 echo <JSON_QUERY> | fn call /<YOUR_APP>/<TABLE_NAME>/select 25 ```