From 523be4d21c7ee89dcbb7779aec17611ff9382f8c Mon Sep 17 00:00:00 2001 From: "kayos@tcp.direct" Date: Sun, 9 Jan 2022 22:57:57 -0800 Subject: [PATCH] Modelling database with a different design principle in mind --- data/types.go | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 data/types.go diff --git a/data/types.go b/data/types.go new file mode 100644 index 0000000..901f1d8 --- /dev/null +++ b/data/types.go @@ -0,0 +1,97 @@ +package data + +type Sex uint8 + +const ( + Male Sex = iota + Female + Neither +) + +// Key/Value: Key is ID +type Player struct { + ID uint64 + Username string + Password string // bcrypt hash + Sex Sex + Figure string // 1000118001270012900121001 + PoolFigure string + Motto string + ConsoleMotto string + Birthday time.Time + Email string + SoundEnabled bool + CreatedOn time.Time + LastOnline time.Time + Credits int + Film int + Tickets int +} + +// Key/Value: Key is ID +type Badges struct { + ID uint64 + Code string +} + +// Key/Value: Key is PlayerID +type PlayerBadge struct { + PlayerID uint64 // Directly tied to ID from Player struct + BadgeID uint64 // Directly tied to ID from Badges struct + Display bool +} + +// Key/Value: Key is ID +type RoomCategorie struct { + ID uint64 + ParentID uint64 // ? + OrderID uint64 // ? + Name string + IsNode bool + IsPublic bool + IsTrading bool + MinRankAccess int + MinRankSetFlatCat int +} + +// Key/Value: Key is ID +type RoomModel struct { + ID uint64 + name string + door_x int + door_y int + door_z int64 // 10 = 1.0 - 225 = 2.25 - etc + door_dir int + heightmap string +} + +type RoomAccess uint8 + +const ( + Open RoomAccess = iota + Password + Closed +) + +// Key/Value: Key is ID +type Room struct { + id uint64 + category_id int + name string + description string + owner_id int + model_id int + ccts string + wallpaper int + floor int + show_name bool + password string + access RoomAccess + sudo_users bool + current_visitors int + max_visitors int + rating int + hidden bool + created_at time.Time + updated_at time.Time +}