@awspilot/dynamodb

Issue Star Fork
insert_or_replace.js
insert_or_replace_sql.js
// Insert on Duplicate Item Replace DynamoDB .table('users') .return(DynamoDB.ALL_OLD) .insert_or_replace({ email: 'test@test.com', password: 'qwert', firstname: 'Smith' }, function( err, data ) { console.log( err, data ) })
// Insert on Duplicate Item Replace // new Date() is evaluated to String or Number when parsed DynamoDB.query(` REPLACE INTO tbl_name SET partition_key = uuid('account-######-######'), email = 'test@test.com', five = 3 + 2, last_login_at = null, active = true, binary = Buffer.from('4oya', 'base64'), array = [ 'a', 1, true, null ], object = { 'string': 'text', 'number': 1, 'bool' : true, 'null' : null, }, ss = new StringSet(['a','b','c']), ns = new NumberSet([1,2,3]), bs = new BinarySet( [ Buffer.from('aXRlbTE=','base64') ]), updated_at = new Date().getTime(), expire_at = Math.round( (new Date().getTime() / 1000) + 60*60*24 ) `, function( err, data ){ console.log( err, data ) });