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
| package com.example.fn; | |
| import com.cedarsoftware.util.io.JsonWriter; | |
| import com.fnproject.fn.api.OutputEvent; | |
| import java.sql.*; | |
| import java.util.ArrayList; | |
| import java.util.HashMap; | |
| import java.util.List; |
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
| package com.example.fn; | |
| public class Employee { | |
| private String email; | |
| private String name; | |
| private String dept; | |
| public Employee() {} | |
| public Employee(String email, String name, String dept) { |
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
| package com.example.fn; | |
| import com.cedarsoftware.util.io.JsonWriter; | |
| import com.fnproject.fn.api.OutputEvent; | |
| import java.sql.*; | |
| import java.util.ArrayList; | |
| import java.util.HashMap; | |
| import java.util.List; |
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 '{"email": "bob@nowhere.com", "name": "Bob Smith", "dept": "HR"}' | fn invoke atp-demo-app atp-demo-fn-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 create app --annotation oracle.com/oci/subnetIds='["ocid1.subnet.oc1.phx..."]' --config DB_PASSWORD='[DB PASS]' --config DB_USER='[DB USER]]' --config CONNECT_STRING='[CONNECT STRING FROM tnsnames.ora]' fn-atp-node-json |
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 init --runtime node 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
| schema_version: 20180708 | |
| name: fn-atp-node-json-insert | |
| version: 0.0.91 | |
| runtime: docker | |
| format: http-stream | |
| memory: 256 | |
| timeout: 120 | |
| idle_timeout: 1800 |
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
| FROM oraclelinux:7-slim | |
| RUN yum -y install oracle-release-el7 oracle-nodejs-release-el7 && \ | |
| yum-config-manager --disable ol7_developer_EPEL && \ | |
| yum -y install oracle-instantclient19.3-basiclite nodejs && \ | |
| rm -rf /var/cache/yum && \ | |
| groupadd --gid 1000 --system fn && \ | |
| useradd --uid 1000 --system --gid fn fn | |
| COPY wallet/* /usr/lib/oracle/19.3/client64/lib/network/admin/ |
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
| CREATE TABLE JSON_DEMO | |
| ( | |
| ID NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY INCREMENT BY 1 MAXVALUE 9999999999999999999999999999 MINVALUE 1 CACHE 20 NOT NULL | |
| , CAPTURED_AT TIMESTAMP(6) | |
| , DATA CLOB | |
| , CONSTRAINT JSON_DEMO_PK PRIMARY KEY ( ID ) | |
| ) |
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]; | |
| let pool; | |
| fdk.handle( async function(input){ | |
| if( !pool ) { | |
| pool = await oracledb.createPool({ |