背景我正在尝试将dynamodb.GetItem返回的项目解码到一个对象中,我在那个地方不知道是哪种类型。为此,我有一个函数emptyItemConstructor,它返回所需类型的新对象t。问题我有这样一个函数:funcGetItem(emptyItemConstructorfunc()interface{})interface{}{myItem:=emptyItemConstructor()fmt.Printf("Typeis:%T\n",myItem)_=dynamodbattribute.UnmarshalMap(item,&myItem)fmt.Printf("Typenow
我想做什么?-我想使用DynamoDBMapper将一批记录保存到DynamoDB。模型类packagemodel;importcom.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute;importcom.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAutoGeneratedKey;importcom.amazonaws.services.dynamodbv2.datamodeling.DynamoDBDocument;importcom.amazonaws
我有一个具有以下结构的Dynamodb表:typeStatusItemstruct{requestStatusstringtimestampstringRequestIdstring}我有这样的代码:items:=[]StatusItem{}err=dynamodbattribute.UnmarshalListOfMaps(result.Items,&items)iferr!=nil{exitWithError(fmt.Errorf("failedtounmarshalQueryresultitems,%v",err))}//Printouttheitemsreturnedfori,i
我有一个具有以下结构的Dynamodb表:typeStatusItemstruct{requestStatusstringtimestampstringRequestIdstring}我有这样的代码:items:=[]StatusItem{}err=dynamodbattribute.UnmarshalListOfMaps(result.Items,&items)iferr!=nil{exitWithError(fmt.Errorf("failedtounmarshalQueryresultitems,%v",err))}//Printouttheitemsreturnedfori,i