func()

in iot-onboarding-service/src/cloudrack-lambda-core/db/db.go [122:143]


func (dbc DBConfig) Save(prop interface{}) (interface{}, error) {
	err := ValidateConfig(dbc)
	if err != nil {
		return nil, err
	}
	av, err := dynamodbattribute.MarshalMap(prop)
	if err != nil {
		fmt.Println("Got error marshalling new property item:")
		fmt.Println(err.Error())
	}
	input := &dynamodb.PutItemInput{
		Item:      av,
		TableName: aws.String(dbc.TableName),
	}

	_, err = dbc.DbService.PutItemWithContext(dbc.LambdaContext, input)
	if err != nil {
		fmt.Println("Got error calling PutItem:")
		fmt.Println(err.Error())
	}
	return prop, err
}