同步proto

This commit is contained in:
joylink_zhaoerwei 2024-09-27 14:22:11 +08:00
parent f7840ff0f3
commit 5c2bca34ee
2 changed files with 218 additions and 4 deletions

View File

@ -5,20 +5,23 @@
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as pb_1 from "google-protobuf";
export namespace common {
export enum Role {
Role_Unknown = 0,
Role_Admin = 1,
Role_User = 2
}
export enum DataType {
DataType_Unknown = 0,
DataType_Em = 1,
DataType_Ibp = 2,
DataType_Psl = 3,
DataType_Iscs = 4
}
export enum IscsStyle {
IscsStyle_Unknown = 0,
DaShiZhiNeng = 1
IscsStyle_DaShiZhiNeng = 1
}
export enum FeatureType {
FeatureType_Unknown = 0,
FeatureType_Simulation = 1,
FeatureType_Ur = 1,
FeatureType_RunPlan = 2
}
export class Canvas extends pb_1.Message {

View File

@ -0,0 +1,211 @@
/**
* Generated by the protoc-gen-ts. DO NOT EDIT!
* compiler version: 5.27.4
* source: sync_data_message.proto
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as pb_1 from "google-protobuf";
export namespace sync_data_message {
export class SyncData extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
operationType?: string;
datas?: UpdataData[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("operationType" in data && data.operationType != undefined) {
this.operationType = data.operationType;
}
if ("datas" in data && data.datas != undefined) {
this.datas = data.datas;
}
}
}
get operationType() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set operationType(value: string) {
pb_1.Message.setField(this, 1, value);
}
get datas() {
return pb_1.Message.getRepeatedWrapperField(this, UpdataData, 2) as UpdataData[];
}
set datas(value: UpdataData[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value);
}
static fromObject(data: {
operationType?: string;
datas?: ReturnType<typeof UpdataData.prototype.toObject>[];
}): SyncData {
const message = new SyncData({});
if (data.operationType != null) {
message.operationType = data.operationType;
}
if (data.datas != null) {
message.datas = data.datas.map(item => UpdataData.fromObject(item));
}
return message;
}
toObject() {
const data: {
operationType?: string;
datas?: ReturnType<typeof UpdataData.prototype.toObject>[];
} = {};
if (this.operationType != null) {
data.operationType = this.operationType;
}
if (this.datas != null) {
data.datas = this.datas.map((item: UpdataData) => item.toObject());
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.operationType.length)
writer.writeString(1, this.operationType);
if (this.datas.length)
writer.writeRepeatedMessage(2, this.datas, (item: UpdataData) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SyncData {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SyncData();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.operationType = reader.readString();
break;
case 2:
reader.readMessage(message.datas, () => pb_1.Message.addToRepeatedWrapperField(message, 2, UpdataData.deserialize(reader), UpdataData));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): SyncData {
return SyncData.deserialize(bytes);
}
}
export class UpdataData extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
id?: number;
type?: string;
data?: Uint8Array;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("id" in data && data.id != undefined) {
this.id = data.id;
}
if ("type" in data && data.type != undefined) {
this.type = data.type;
}
if ("data" in data && data.data != undefined) {
this.data = data.data;
}
}
}
get id() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set id(value: number) {
pb_1.Message.setField(this, 1, value);
}
get type() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set type(value: string) {
pb_1.Message.setField(this, 2, value);
}
get data() {
return pb_1.Message.getFieldWithDefault(this, 3, new Uint8Array(0)) as Uint8Array;
}
set data(value: Uint8Array) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
id?: number;
type?: string;
data?: Uint8Array;
}): UpdataData {
const message = new UpdataData({});
if (data.id != null) {
message.id = data.id;
}
if (data.type != null) {
message.type = data.type;
}
if (data.data != null) {
message.data = data.data;
}
return message;
}
toObject() {
const data: {
id?: number;
type?: string;
data?: Uint8Array;
} = {};
if (this.id != null) {
data.id = this.id;
}
if (this.type != null) {
data.type = this.type;
}
if (this.data != null) {
data.data = this.data;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.id != 0)
writer.writeUint32(1, this.id);
if (this.type.length)
writer.writeString(2, this.type);
if (this.data.length)
writer.writeBytes(3, this.data);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): UpdataData {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new UpdataData();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.id = reader.readUint32();
break;
case 2:
message.type = reader.readString();
break;
case 3:
message.data = reader.readBytes();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): UpdataData {
return UpdataData.deserialize(bytes);
}
}
}