Interaction functions

In this section, we will create a tool that stores location records to a database and query location points for a specific user. To represent a location in the code, we declare the following Location struct:

#[derive(Debug)]struct Location {    user_id: String,    timestamp: String,    longitude: String,    latitude: String,}

This struct keeps user_id, which represents the partition key, and timestamp, which represents the sort key.

DynamoDB is a key-value storage, where every record has a unique key. When you declare tables, you have to decide which attributes will be the key of a record. You can choose up to two keys. The first is required and represents a partition key that's used to distribute data across database partitions. ...

Get Hands-On Microservices with Rust now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.