Creating Types: The Shape of your Data
In TempestDB, everything begins with types. They define what you want to
store. There are two kinds of user defined types: structs and enums.
Using struct
As the name suggests, this is used to create new data structures, which are
defined as having certain fields, each with a specific type. If you've ever
done something like C/C++, Rust, or Zig, you've already seen plenty
of structs before.
Let's start by defining a User inside of the main database. I've already
went ahead and created the database for you, so you don't have to worry about
that part. It should have a unique ID, as well as a name.
For the ID, you can use the Int64 type, which is a 64-bit integer. For the
name, you can use a String - that's just text.
Combining all of this into a TQL statement:
create type main.User struct { id: Int64, name: String };
Now if you run .types main, you should see your new entry there!