小编Chu*_*ams的帖子

Scala如何知道"def foo"和"def foo()"之间的区别?

我知道scala中的空参数和无参数方法之间的使用差异,我的问题与生成的类文件有关.当我在javap中查看这两个类时,它们看起来完全相同:

class Foo {
  def bar() = 123;
}


class Foo {
  def bar = 123;
}
Run Code Online (Sandbox Code Playgroud)

但是当我在scalap中查看它们时,它们会准确地反映参数列表.在类文件中scalac的位置是否已知这种区别?

scala

21
推荐指数
1
解决办法
496
查看次数

Lambda 中的 DynamoDB updateItem 以静默方式失败

我试图用 Lambda 函数实现一个简单的计数器,但是每当我测试它时,下面的 updateItem 根本不起作用:回调中的任何日志语句都没有运行,当然还有表中的相关计数器永远不会更新。这是我的 lambda 函数:

'use strict';
const AWS = require('aws-sdk');
const dynamodb = new AWS.DynamoDB({ apiVersion: '2012-08-10' });

let params = {
    TableName: 'Counters',
    Key: {
        'name': { S: 'global' }
    },
    UpdateExpression: 'SET val = val + :inc',
    ExpressionAttributeValues: {
        ':inc': { N: '1' }
    },
    ReturnValues: 'ALL_NEW'
};

exports.handler = async(event) => {
    console.log("Invoked counter-test");

    dynamodb.updateItem(params, function(err, data) {
        console.log("In updateItem callback");
        if (err)
            console.log(err, err.stack);
        else
            console.log(data);
    });

    console.log("Updated counter");

    const response = { …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-dynamodb aws-lambda

1
推荐指数
1
解决办法
1048
查看次数