There is an example in SurrealDB documentation about using Rust's structs to store received data:
#[derive(Debug, Serialize)]
struct Name<'a> {
first: &'a str,
last: &'a str,
}
#[derive(Debug, Serialize)]
struct Person<'a> {
title: &'a str,
name: Name<'a>,
marketing: bool,
}
I couldn't find an example about storing a Record in a struct. Should I use Thing
or create a struct called Record
with id
field?
For example this is the database schema I use and I want to store the select result of a notification
table as a struct:
Schema.surql:
DEFINE TABLE notification SCHEMAFULL;
DEFINE FIELD content ON notification TYPE string;
DEFINE FIELD user_id ON notification TYPE record(user);
Notification Struct:
#[derive(Debug, Serialize)]
struct Notification {
content: String,
user_id: TYPE_HERE, <= ???
}
What is the type to store record linkage in Rust?
Thanks!