Files
kratos-bootstrap/api/protos/pagination/v1/pagination.proto
2024-12-15 12:12:46 +08:00

83 lines
2.8 KiB
Protocol Buffer
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

syntax = "proto3";
package pagination;
option go_package = "github.com/tx7do/kratos-bootstrap/gen/api/go/pagination/v1;pagination";
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}
}
];
// AND过滤参数其语法为json格式的字符串{"key1":"val1","key2":"val2"}具体请参见https://github.com/tx7do/go-utils/tree/main/entgo/query/README.md
optional string query = 3 [
json_name = "query",
(gnostic.openapi.v3.property) = {
description: "AND过滤参数其语法为json格式的字符串{\"key1\":\"val1\",\"key2\":\"val2\"}具体请参见https://github.com/tx7do/go-utils/tree/main/entgo/query/README.md",
example: {yaml: "{\"key1\":\"val1\",\"key2\":\"val2\"}"}
}
];
// OR过滤参数语法同AND过滤参数。
optional string or_query = 4 [
json_name = "or",
(gnostic.openapi.v3.property) = {
description: "OR过滤参数",
example: {yaml: "{\"key1\":\"val1\",\"key2\":\"val2\"}"}
}
];
// 排序条件其语法为JSON字符串例如{"val1", "-val2"}。字段名前加'-'为降序,否则为升序。
repeated string order_by = 5 [
json_name = "orderBy",
(gnostic.openapi.v3.property) = {
description: "排序条件其语法为JSON字符串例如{\"val1\", \"-val2\"}。字段名前加'-'为降序,否则为升序。"
example: {yaml: "{\"val1\", \"-val2\"}"}
}
];
// 是否不分页如果为true则page和pageSize参数无效。
optional bool no_paging = 6 [
json_name = "noPaging",
(gnostic.openapi.v3.property) = {
description: "是否不分页如果为true则page和pageSize参数无效。"
}
];
// 字段掩码其作用为SELECT中的字段其语法为使用逗号分隔字段名例如id,realName,userName。如果为空则选中所有字段即SELECT *。
optional google.protobuf.FieldMask field_mask = 7 [
json_name = "fieldMask",
(gnostic.openapi.v3.property) = {
description: "字段掩码其作用为SELECT中的字段其语法为使用逗号分隔字段名例如id,realName,userName。如果为空则选中所有字段即SELECT *。",
example: {yaml : "id,realName,userName"}
}
];
}
// 分页通用结果
message PagingResponse {
// 总数
int32 total = 1;
// 分页数据
repeated bytes items = 2;
}