This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fdk = require('@fnproject/fdk'); | |
| const oracledb = require('oracledb'); | |
| const dateFormat = require('dateformat'); | |
| oracledb.outFormat = oracledb.OBJECT; | |
| oracledb.fetchAsString = [oracledb.CLOB]; | |
| let pool; | |
| fdk.handle( async function(input){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo '{"isDemo": true, "key": 5, "isAwesome": true, "isEasy": true}' | fn invoke fn-atp-node-json fn-atp-node-json-insert |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trsharp@MacBook-Pro-2 ~/Projects/fn/fn-atp-node-json/throwaway$ fn invoke fn-atp-node-json fn-atp-node-json-read | |
| [{"id":66,"capturedAt":"2019-06-11T21:33:04.000Z","data":{"isDemo":true,"key":5,"isAwesome":true,"isEasy":true}}] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fdk = require('@fnproject/fdk'); | |
| const oracledb = require('oracledb'); | |
| oracledb.outFormat = oracledb.OBJECT; | |
| oracledb.fetchAsString = [oracledb.CLOB]; | |
| oracledb.autoCommit = true; | |
| fdk.handle( async function(input){ | |
| let connection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ echo '{"id": 1, "temp": 58}' | fn invoke fn-atp-node-json fn-atp-node-json-soda | |
| $ echo '{"id": 2, "temp": 60}' | fn invoke fn-atp-node-json fn-atp-node-json-soda |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select id, utl_raw.cast_to_varchar2(json_document) as doc | |
| from soda_collection sc | |
| where sc.json_document.temp < 60; | |
| /* | |
| ID DOC | |
| ----- ----- | |
| E05734C093684FBEBFDEC3404099F959 {"id":1,"temp":58} | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select id, jt.temp, jt.docId | |
| from soda_collection sc, | |
| json_table(json_document, '$' COLUMNS (temp number PATH '$.temp', docId varchar2(50) PATH '$.id')) as jt | |
| /* | |
| ID TEMP DOCID | |
| ----- ----- ----- | |
| E05734C093684FBEBFDEC3404099F959 58 1 | |
| B675F6056E374F9ABF76C6E35A280ED5 60 2 | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ fn inspect function fn-atp-node-json fn-atp-node-json-read |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "annotations": { | |
| "fnproject.io/fn/invokeEndpoint": "https://xicciwch3fq.us-phoenix-1.functions.oci.oraclecloud.com/20181201/functions/ocid1.fnfunc..../actions/invoke", | |
| "oracle.com/oci/compartmentId": "ocid1.compartment...." | |
| }, | |
| "app_id": "ocid1.fnapp....", | |
| "created_at": "2019-04-02T14:15:47.129Z", | |
| "id": "ocid1.fnfunc....", | |
| "idle_timeout": 30, | |
| "image": "phx.ocir.io/toddrsharp/faas/fn-atp-node-json-read:0.0.91", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String endpoint = "https://xicciwch3fq.us-phoenix-1.functions.oci.oraclecloud.com" | |
| String insertId = "ocid1.fnfunc.oc1.us-phoenix-1..." | |
| String readId = "ocid1.fnfunc.oc1.us-phoenix-1..." | |
| String payload = JsonOutput.toJson([isCool: true, createdOn: new Date()]) | |
| AuthenticationDetailsProvider authProvider = new ConfigFileAuthenticationDetailsProvider('DEFAULT') |