我得到了一个从 AWS-Amplify GraphQL(我相信它使用 apollo-codegen)自动生成的 TypeScript 类型,如下所示:
export type GetNoteQuery = {
getNote: {
__typename: "Note",
id: string,
createdAt: string | null,
updatedAt: string | null,
title: boolean | null,
content: string | null,
} | null,
Run Code Online (Sandbox Code Playgroud)
我想生成一个“Note”的基本类型,用作“基本”类型,以便在使用返回的数据时在我的代码中使用。即将笔记映射到 React 组件等。
有没有办法缩小这种自动生成的类型,或者以某种方式扩展它,让它看起来像:
export type GetNoteQuery = {
getNote: {
__typename: "Note",
id: string,
createdAt: string | null,
updatedAt: string | null,
title: boolean | null,
content: string | null,
} | null,
Run Code Online (Sandbox Code Playgroud) 最新版本的aws-sdk具有ComprehendMedical函数,我想为其创建lambda函数。
但是,AWS-SDK的版本已经过时了几个月,尚无法使用这些功能。想知道是否有使用最新库的方法?
谢谢!
amazon-web-services node.js aws-sdk aws-lambda aws-sdk-nodejs
我正在尝试查询特定日期范围内所有项目的项(其中具有AWS DateTime的CreatedAt和UpdatedAt字段)。例如,过去48小时。
例如,使用以下架构:
type Note @model @searchable @auth(rules: [{ allow: owner }]) {
id: ID!
note: String
createdAt: AWSDateTime
Run Code Online (Sandbox Code Playgroud)
我可以使用以下方式搜索日期:
query {
searchNotes(filter:{createdAt: { matchPhrasePrefix: "2018-12-27"}}) {
items{
id
title
createdAt
}
}
}
Run Code Online (Sandbox Code Playgroud)
它返回所有带有该字符串前缀的与UTC时间匹配的音符。
从那里,我必须使用moment.diff()或其他方法对自己进行排序。
我不确定是否有使用AppSync和GraphQl按日期和时间进行搜索/筛选的更好/更有效的方法?
谢谢。
aws-amplify ×2
aws-appsync ×2
graphql ×2
amplifyjs ×1
aws-lambda ×1
aws-sdk ×1
node.js ×1
typescript ×1