summaryrefslogtreecommitdiff
path: root/backend/src/Models/Description.zig
diff options
context:
space:
mode:
authorphyscik <mynameisgennadiy@vk.com>2026-04-27 15:31:39 +0500
committerphyscik <mynameisgennadiy@vk.com>2026-04-27 15:31:39 +0500
commitb5ce961b3ef30758f77e2487dc9b6ed2dd39de73 (patch)
treed9d892fdd07b462f1b65495d8b9dbdc7f964b797 /backend/src/Models/Description.zig
parentb044c0354c46eadb9f4c66565779e9cb5ce92699 (diff)
Weapon description support
Diffstat (limited to 'backend/src/Models/Description.zig')
-rw-r--r--backend/src/Models/Description.zig36
1 files changed, 36 insertions, 0 deletions
diff --git a/backend/src/Models/Description.zig b/backend/src/Models/Description.zig
new file mode 100644
index 0000000..a3774ab
--- /dev/null
+++ b/backend/src/Models/Description.zig
@@ -0,0 +1,36 @@
+const std = @import("std");
+const pg = @import("pg");
+
+// Is suitable for those tables:
+// - RangedWeaponsDescriptions
+pub const Description = struct {
+ Id: []const u8,
+ Language: []const u8,
+ Contents: []const u8,
+
+ // Parses the db row and returns the result. You are expected to use the
+ // actual DB schema and use * as a fields selector
+ pub fn Map(row: *const pg.Row) !Description {
+ return Description {
+ .Id = try row.get([]const u8, 0),
+ .Language = try row.get([]const u8, 1),
+ .Contents = try row.get([]const u8, 2),
+ };
+ }
+
+ // Parses the db row and returns the result. You are expected to use the
+ // actual DB schema and use * as a fields selector
+ pub fn MapWithAlloc(allocator: std.mem.Allocator, row: *const pg.Row) !Description {
+ return Description {
+ .Id = try allocator.dupe(u8, try row.get([]const u8, 0)),
+ .Language = try allocator.dupe(u8, try row.get([]const u8, 1)),
+ .Contents = try allocator.dupe(u8, try row.get([]const u8, 2)),
+ };
+ }
+
+};
+
+pub const RequestBody = struct {
+ Language: []const u8,
+ Contents: []const u8,
+};