82 lines
1.9 KiB
Protocol Buffer
82 lines
1.9 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package pagination;
|
|
|
|
option go_package = "github.com/tx7do/kratos-bootstrap/gen/api/go/pagination/v1;pagination";
|
|
|
|
import "google/protobuf/any.proto";
|
|
import "google/protobuf/field_mask.proto";
|
|
import "gnostic/openapi/v3/annotations.proto";
|
|
|
|
// 分页通用请求
|
|
message PagingRequest {
|
|
// 当前页码
|
|
optional int32 page = 1 [
|
|
json_name = "page",
|
|
(gnostic.openapi.v3.property) = {
|
|
description: "当前页码",
|
|
default: {number: 1}
|
|
}
|
|
];
|
|
|
|
// 每页的行数
|
|
optional int32 page_size = 2 [
|
|
json_name = "pageSize",
|
|
(gnostic.openapi.v3.property) = {
|
|
description: "每一页的行数",
|
|
default: {number: 10}
|
|
}
|
|
];
|
|
|
|
// 与过滤参数
|
|
optional string query = 3 [
|
|
json_name = "query",
|
|
(gnostic.openapi.v3.property) = {
|
|
description: "与过滤参数",
|
|
example: {yaml: "{\"key1\":\"val1\",\"key2\":\"val2\"}"}
|
|
}
|
|
];
|
|
|
|
// 或过滤参数
|
|
optional string or_query = 4 [
|
|
json_name = "or",
|
|
(gnostic.openapi.v3.property) = {
|
|
description: "或过滤参数",
|
|
example: {yaml: "{\"key1\":\"val1\",\"key2\":\"val2\"}"}
|
|
}
|
|
];
|
|
|
|
// 排序条件
|
|
repeated string order_by = 5 [
|
|
json_name = "orderBy",
|
|
(gnostic.openapi.v3.property) = {
|
|
description: "排序条件,字段名前加'-'为降序,否则为升序。"
|
|
example: {yaml: "{\"val1\", \"-val2\"}"}
|
|
}
|
|
];
|
|
|
|
// 是否不分页
|
|
optional bool no_paging = 6 [
|
|
json_name = "nopaging",
|
|
(gnostic.openapi.v3.property) = {description: "是否不分页"}
|
|
];
|
|
|
|
// 字段掩码
|
|
google.protobuf.FieldMask field_mask = 7 [
|
|
json_name = "fieldMask",
|
|
(gnostic.openapi.v3.property) = {
|
|
description: "字段掩码,如果为空则选中所有字段。",
|
|
example: {yaml : "id,realName,userName"}
|
|
}
|
|
];
|
|
}
|
|
|
|
// 分页通用结果
|
|
message PagingResponse {
|
|
// 总数
|
|
int32 total = 1;
|
|
|
|
// 分页数据
|
|
repeated google.protobuf.Any items = 2;
|
|
}
|