好的,所以我正在使用 MongoDB Realm 函数,这是一个无服务器平台,您可以像这样定义函数:
exports = async function(param1, param2){
var result = {}
// do stuff
return result;
}
if (typeof module === 'object') {
module.exports = exports;
}
Run Code Online (Sandbox Code Playgroud)
我想问一下是否可以在 Elm 函数中编码并在 nodejs 运行时中运行它?换句话说,像这样:
exports = async function(param1, param2){
var result = {}
// do stuff
// call elm compiled js
return elmFunction(param1, param2);
}
var elmFunction = async function(param1, param2) {
// generator elm code
};
Run Code Online (Sandbox Code Playgroud) 我在使用这段代码时遇到了一些问题:
public boolean isExists(String key) {
try {
this.s3Client.getObjectMetadata(this.bucketName, key);
return true;
} catch (AmazonServiceException var3) {
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
它总是返回 false,即使 S3 中的“文件夹”存在(空或非空),可能会出现什么问题?
上面的代码s3Client只是一个简单的AmazonS3客户端:
AmazonS3 s3client = AmazonS3ClientBuilder
.standard()
.withCredentials(new AWSStaticCredentialsProvider(credentials))
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(objectStoreEndpoint, objectStoreRegion))
.build();
Run Code Online (Sandbox Code Playgroud)
检查 S3 中是否存在文件夹的正确方法是什么?
使用 Amazon S3(或 S3 兼容的对象存储)作为应用程序的主数据库有哪些限制。
这个库看起来很有前途,有这个 API:
// Setup Dyno
Dyno dyno = DynoClientBuilder
.simple()
.withEndpointConfig("s3.wasabi.sys", "us-east-1")
.withCredentials(ACCESS_KEY, SECRET_KEY)
.withBucket("dyno")
.withKeySpace(":")
.withBufferSize(1024)
.build();
// Here's a sample way to create a "User" entity with Dyno
// First create an entity with user_id this will prevent creation of another user
// with the same username
Entity user = EnityBuilder
.create(dyno)
.with("username", "dino")
.with("user_id")
.build(uuid(), String.class)
.putIfAbsent();
Run Code Online (Sandbox Code Playgroud)
进一步使用此代码:
// Since the username "dino" has been secured we can assign the password …Run Code Online (Sandbox Code Playgroud)