mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: include slugs in both
This commit is contained in:
1 parent
16b3a59f88
commit
2fffd512ac
4 files changed
+94
-16
No files matched your search
@@ -6,5 +6,6 @@ package blitzkit;
|
||||
|
||||
message Tank {
|
||||
required string id = 1;
|
||||
required I18n name = 2;
|
||||
required string slug = 2;
|
||||
required I18n name = 3;
|
||||
}
|
||||
@@ -12,11 +12,12 @@ export const protobufPackage = "blitzkit";
|
||||
|
||||
export interface Tank {
|
||||
id: string;
|
||||
slug: string;
|
||||
name: I18n;
|
||||
}
|
||||
|
||||
function createBaseTank(): Tank {
|
||||
return { id: "", name: createBaseI18n() };
|
||||
return { id: "", slug: "", name: createBaseI18n() };
|
||||
}
|
||||
|
||||
export const Tank: MessageFns<Tank> = {
|
||||
@@ -24,8 +25,11 @@ export const Tank: MessageFns<Tank> = {
|
||||
if (message.id !== "") {
|
||||
writer.uint32(10).string(message.id);
|
||||
}
|
||||
if (message.slug !== "") {
|
||||
writer.uint32(18).string(message.slug);
|
||||
}
|
||||
if (message.name !== undefined) {
|
||||
I18n.encode(message.name, writer.uint32(18).fork()).join();
|
||||
I18n.encode(message.name, writer.uint32(26).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
@@ -50,6 +54,14 @@ export const Tank: MessageFns<Tank> = {
|
||||
break;
|
||||
}
|
||||
|
||||
message.slug = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 26) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.name = I18n.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
@@ -65,6 +77,7 @@ export const Tank: MessageFns<Tank> = {
|
||||
fromJSON(object: any): Tank {
|
||||
return {
|
||||
id: globalThis.String(assertSet("Tank.id", object.id)),
|
||||
slug: globalThis.String(assertSet("Tank.slug", object.slug)),
|
||||
name: I18n.fromJSON(assertSet("Tank.name", object.name)),
|
||||
};
|
||||
},
|
||||
@@ -74,6 +87,9 @@ export const Tank: MessageFns<Tank> = {
|
||||
if (message.id !== "") {
|
||||
obj.id = message.id;
|
||||
}
|
||||
if (message.slug !== "") {
|
||||
obj.slug = message.slug;
|
||||
}
|
||||
if (message.name !== undefined) {
|
||||
obj.name = I18n.toJSON(message.name);
|
||||
}
|
||||
@@ -86,6 +102,7 @@ export const Tank: MessageFns<Tank> = {
|
||||
fromPartial<I extends Exact<DeepPartial<Tank>, I>>(object: I): Tank {
|
||||
const message = createBaseTank();
|
||||
message.id = object.id ?? "";
|
||||
message.slug = object.slug ?? "";
|
||||
message.name = (object.name !== undefined && object.name !== null)
|
||||
? I18n.fromPartial(object.name)
|
||||
: createBaseI18n();
|
||||
|
||||
Reference in new issue
Block a user