mirror of
https://github.com/zhufuyi/sponge.git
synced 2025-10-30 04:02:05 +08:00
feat: support custom table primary key type and name
This commit is contained in:
@@ -297,9 +297,22 @@ import "validate/validate.proto";
|
||||
|
||||
option go_package = "github.com/zhufuyi/sponge/api/serverNameExample/v1;v1";
|
||||
|
||||
// Default settings for generating swagger documents
|
||||
// NOTE: because json does not support 64 bits, the int64 and uint64 types under *.swagger.json are automatically converted to string types
|
||||
// Reference https://github.com/grpc-ecosystem/grpc-gateway/blob/db7fbefff7c04877cdb32e16d4a248a024428207/examples/internal/proto/examplepb/a_bit_of_everything.proto
|
||||
/*
|
||||
Reference https://github.com/grpc-ecosystem/grpc-gateway/blob/db7fbefff7c04877cdb32e16d4a248a024428207/examples/internal/proto/examplepb/a_bit_of_everything.proto
|
||||
Default settings for generating swagger documents
|
||||
NOTE: because json does not support 64 bits, the int64 and uint64 types under *.swagger.json are automatically converted to string types
|
||||
Tips: add swagger option to rpc method, example:
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "get user by id",
|
||||
description: "get user by id",
|
||||
security: {
|
||||
security_requirement: {
|
||||
key: "BearerAuth";
|
||||
value: {}
|
||||
}
|
||||
}
|
||||
};
|
||||
*/
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
||||
host: "localhost:8080"
|
||||
base_path: ""
|
||||
@@ -331,16 +344,6 @@ service {{.TName}} {
|
||||
post: "/api/v1/{{.TName}}"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "create {{.TName}}",
|
||||
description: "submit information to create {{.TName}}",
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
// value: {}
|
||||
// }
|
||||
//}
|
||||
};
|
||||
}
|
||||
|
||||
// delete {{.TName}} by id
|
||||
@@ -348,16 +351,6 @@ service {{.TName}} {
|
||||
option (google.api.http) = {
|
||||
delete: "/api/v1/{{.TName}}/{id}"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "delete {{.TName}}",
|
||||
description: "delete {{.TName}} by id",
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
// value: {}
|
||||
// }
|
||||
//}
|
||||
};
|
||||
}
|
||||
|
||||
// update {{.TName}} by id
|
||||
@@ -366,16 +359,6 @@ service {{.TName}} {
|
||||
put: "/api/v1/{{.TName}}/{id}"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "update {{.TName}}",
|
||||
description: "update {{.TName}} by id",
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
// value: {}
|
||||
// }
|
||||
//}
|
||||
};
|
||||
}
|
||||
|
||||
// get {{.TName}} by id
|
||||
@@ -383,16 +366,6 @@ service {{.TName}} {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/{{.TName}}/{id}"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "get {{.TName}} detail",
|
||||
description: "get {{.TName}} detail by id",
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
// value: {}
|
||||
// }
|
||||
//}
|
||||
};
|
||||
}
|
||||
|
||||
// list of {{.TName}} by query parameters
|
||||
@@ -401,16 +374,6 @@ service {{.TName}} {
|
||||
post: "/api/v1/{{.TName}}/list"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "list of {{.TName}}s by parameters",
|
||||
description: "list of {{.TName}}s by paging and conditions",
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
// value: {}
|
||||
// }
|
||||
//}
|
||||
};
|
||||
}
|
||||
|
||||
// delete {{.TName}} by batch id
|
||||
@@ -419,16 +382,6 @@ service {{.TName}} {
|
||||
post: "/api/v1/{{.TName}}/delete/ids"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "delete {{.TName}}s by batch id",
|
||||
description: "delete {{.TName}}s by batch id",
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
// value: {}
|
||||
// }
|
||||
//}
|
||||
};
|
||||
}
|
||||
|
||||
// get {{.TName}} by condition
|
||||
@@ -437,16 +390,6 @@ service {{.TName}} {
|
||||
post: "/api/v1/{{.TName}}/condition"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "get {{.TName}} detail by condition",
|
||||
description: "get {{.TName}} detail by condition",
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
// value: {}
|
||||
// }
|
||||
//}
|
||||
};
|
||||
}
|
||||
|
||||
// list of {{.TName}} by batch id
|
||||
@@ -455,16 +398,6 @@ service {{.TName}} {
|
||||
post: "/api/v1/{{.TName}}/list/ids"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "list of {{.TName}}s by batch id",
|
||||
description: "list of {{.TName}}s by batch id",
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
// value: {}
|
||||
// }
|
||||
//}
|
||||
};
|
||||
}
|
||||
|
||||
// list {{.TName}} by last id
|
||||
@@ -472,16 +405,6 @@ service {{.TName}} {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/{{.TName}}/list"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "list of {{.TName}} by last id",
|
||||
description: "list of {{.TName}} by last id",
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
// value: {}
|
||||
// }
|
||||
//}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -595,9 +518,22 @@ import "validate/validate.proto";
|
||||
|
||||
option go_package = "github.com/zhufuyi/sponge/api/serverNameExample/v1;v1";
|
||||
|
||||
// Default settings for generating swagger documents
|
||||
// NOTE: because json does not support 64 bits, the int64 and uint64 types under *.swagger.json are automatically converted to string types
|
||||
// Reference https://github.com/grpc-ecosystem/grpc-gateway/blob/db7fbefff7c04877cdb32e16d4a248a024428207/examples/internal/proto/examplepb/a_bit_of_everything.proto
|
||||
/*
|
||||
Reference https://github.com/grpc-ecosystem/grpc-gateway/blob/db7fbefff7c04877cdb32e16d4a248a024428207/examples/internal/proto/examplepb/a_bit_of_everything.proto
|
||||
Default settings for generating swagger documents
|
||||
NOTE: because json does not support 64 bits, the int64 and uint64 types under *.swagger.json are automatically converted to string types
|
||||
Tips: add swagger option to rpc method, example:
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "get user by id",
|
||||
description: "get user by id",
|
||||
security: {
|
||||
security_requirement: {
|
||||
key: "BearerAuth";
|
||||
value: {}
|
||||
}
|
||||
}
|
||||
};
|
||||
*/
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
||||
host: "localhost:8080"
|
||||
base_path: ""
|
||||
@@ -629,16 +565,6 @@ service {{.TName}} {
|
||||
post: "/api/v1/{{.TName}}"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "create {{.TName}}",
|
||||
description: "submit information to create {{.TName}}",
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
// value: {}
|
||||
// }
|
||||
//}
|
||||
};
|
||||
}
|
||||
|
||||
// delete {{.TName}} by id
|
||||
@@ -646,16 +572,6 @@ service {{.TName}} {
|
||||
option (google.api.http) = {
|
||||
delete: "/api/v1/{{.TName}}/{id}"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "delete {{.TName}}",
|
||||
description: "delete {{.TName}} by id",
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
// value: {}
|
||||
// }
|
||||
//}
|
||||
};
|
||||
}
|
||||
|
||||
// update {{.TName}} by id
|
||||
@@ -664,16 +580,6 @@ service {{.TName}} {
|
||||
put: "/api/v1/{{.TName}}/{id}"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "update {{.TName}}",
|
||||
description: "update {{.TName}} by id",
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
// value: {}
|
||||
// }
|
||||
//}
|
||||
};
|
||||
}
|
||||
|
||||
// get {{.TName}} by id
|
||||
@@ -681,16 +587,6 @@ service {{.TName}} {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/{{.TName}}/{id}"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "get {{.TName}} detail",
|
||||
description: "get {{.TName}} detail by id",
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
// value: {}
|
||||
// }
|
||||
//}
|
||||
};
|
||||
}
|
||||
|
||||
// list of {{.TName}} by query parameters
|
||||
@@ -699,16 +595,6 @@ service {{.TName}} {
|
||||
post: "/api/v1/{{.TName}}/list"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "list of {{.TName}}s by parameters",
|
||||
description: "list of {{.TName}}s by paging and conditions",
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
// value: {}
|
||||
// }
|
||||
//}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user