fix: 统一分页请求的 offset 语义

This commit is contained in:
zetaloop
2026-04-07 17:56:38 +08:00
parent 424b2b1cca
commit d153b5cf51
46 changed files with 334 additions and 346 deletions
+25 -25
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v5.29.6
// protoc v7.34.1
// source: community.proto
package pb
@@ -452,7 +452,7 @@ func (x *GetCommentLikesByIdResp) GetCommentLikes() *CommentLikes {
type SearchCommentLikesReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page
Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset
Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit
CommentId int64 `protobuf:"varint,3,opt,name=commentId,proto3" json:"commentId,omitempty"` //commentId
UserId int64 `protobuf:"varint,4,opt,name=userId,proto3" json:"userId,omitempty"` //userId
@@ -491,9 +491,9 @@ func (*SearchCommentLikesReq) Descriptor() ([]byte, []int) {
return file_community_proto_rawDescGZIP(), []int{9}
}
func (x *SearchCommentLikesReq) GetPage() int64 {
func (x *SearchCommentLikesReq) GetOffset() int64 {
if x != nil {
return x.Page
return x.Offset
}
return 0
}
@@ -1081,7 +1081,7 @@ func (x *GetCommentsByIdResp) GetComments() *Comments {
type SearchCommentsReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page
Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset
Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit
Id int64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` //id
PostId int64 `protobuf:"varint,4,opt,name=postId,proto3" json:"postId,omitempty"` //postId
@@ -1124,9 +1124,9 @@ func (*SearchCommentsReq) Descriptor() ([]byte, []int) {
return file_community_proto_rawDescGZIP(), []int{20}
}
func (x *SearchCommentsReq) GetPage() int64 {
func (x *SearchCommentsReq) GetOffset() int64 {
if x != nil {
return x.Page
return x.Offset
}
return 0
}
@@ -1662,7 +1662,7 @@ func (x *GetPostLikesByIdResp) GetPostLikes() *PostLikes {
type SearchPostLikesReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page
Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset
Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit
PostId *int64 `protobuf:"varint,3,opt,name=postId,proto3,oneof" json:"postId,omitempty"` //postId
UserId *int64 `protobuf:"varint,4,opt,name=userId,proto3,oneof" json:"userId,omitempty"` //userId
@@ -1701,9 +1701,9 @@ func (*SearchPostLikesReq) Descriptor() ([]byte, []int) {
return file_community_proto_rawDescGZIP(), []int{31}
}
func (x *SearchPostLikesReq) GetPage() int64 {
func (x *SearchPostLikesReq) GetOffset() int64 {
if x != nil {
return x.Page
return x.Offset
}
return 0
}
@@ -2507,7 +2507,7 @@ func (x *GetPostsByIdResp) GetPosts() *Posts {
type SearchPostsReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` //page
Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` //offset
Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` //limit
Id int64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` //id
AuthorId *int64 `protobuf:"varint,4,opt,name=authorId,proto3,oneof" json:"authorId,omitempty"` //authorId
@@ -2559,9 +2559,9 @@ func (*SearchPostsReq) Descriptor() ([]byte, []int) {
return file_community_proto_rawDescGZIP(), []int{42}
}
func (x *SearchPostsReq) GetPage() int64 {
func (x *SearchPostsReq) GetOffset() int64 {
if x != nil {
return x.Page
return x.Offset
}
return 0
}
@@ -2756,9 +2756,9 @@ const file_community_proto_rawDesc = "" +
"\x16GetCommentLikesByIdReq\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\"O\n" +
"\x17GetCommentLikesByIdResp\x124\n" +
"\fcommentLikes\x18\x01 \x01(\v2\x10.pb.CommentLikesR\fcommentLikes\"\x95\x01\n" +
"\x15SearchCommentLikesReq\x12\x12\n" +
"\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" +
"\fcommentLikes\x18\x01 \x01(\v2\x10.pb.CommentLikesR\fcommentLikes\"\x99\x01\n" +
"\x15SearchCommentLikesReq\x12\x16\n" +
"\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" +
"\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x1c\n" +
"\tcommentId\x18\x03 \x01(\x03R\tcommentId\x12\x16\n" +
"\x06userId\x18\x04 \x01(\x03R\x06userId\x12\x1c\n" +
@@ -2796,9 +2796,9 @@ const file_community_proto_rawDesc = "" +
"\x12GetCommentsByIdReq\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\"?\n" +
"\x13GetCommentsByIdResp\x12(\n" +
"\bcomments\x18\x01 \x01(\v2\f.pb.CommentsR\bcomments\"\x99\x02\n" +
"\x11SearchCommentsReq\x12\x12\n" +
"\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" +
"\bcomments\x18\x01 \x01(\v2\f.pb.CommentsR\bcomments\"\x9d\x02\n" +
"\x11SearchCommentsReq\x12\x16\n" +
"\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" +
"\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x0e\n" +
"\x02id\x18\x03 \x01(\x03R\x02id\x12\x16\n" +
"\x06postId\x18\x04 \x01(\x03R\x06postId\x12\x1a\n" +
@@ -2837,9 +2837,9 @@ const file_community_proto_rawDesc = "" +
"\x13GetPostLikesByIdReq\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\"C\n" +
"\x14GetPostLikesByIdResp\x12+\n" +
"\tpostLikes\x18\x01 \x01(\v2\r.pb.PostLikesR\tpostLikes\"\xac\x01\n" +
"\x12SearchPostLikesReq\x12\x12\n" +
"\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" +
"\tpostLikes\x18\x01 \x01(\v2\r.pb.PostLikesR\tpostLikes\"\xb0\x01\n" +
"\x12SearchPostLikesReq\x12\x16\n" +
"\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" +
"\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x1b\n" +
"\x06postId\x18\x03 \x01(\x03H\x00R\x06postId\x88\x01\x01\x12\x1b\n" +
"\x06userId\x18\x04 \x01(\x03H\x01R\x06userId\x88\x01\x01\x12\x1c\n" +
@@ -2940,9 +2940,9 @@ const file_community_proto_rawDesc = "" +
"\x0fGetPostsByIdReq\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\"3\n" +
"\x10GetPostsByIdResp\x12\x1f\n" +
"\x05posts\x18\x01 \x01(\v2\t.pb.PostsR\x05posts\"\xf9\x05\n" +
"\x0eSearchPostsReq\x12\x12\n" +
"\x04page\x18\x01 \x01(\x03R\x04page\x12\x14\n" +
"\x05posts\x18\x01 \x01(\v2\t.pb.PostsR\x05posts\"\xfd\x05\n" +
"\x0eSearchPostsReq\x12\x16\n" +
"\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" +
"\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x0e\n" +
"\x02id\x18\x03 \x01(\x03R\x02id\x12\x1f\n" +
"\bauthorId\x18\x04 \x01(\x03H\x00R\bauthorId\x88\x01\x01\x12#\n" +