-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FLGO-45 Fix json fields #46
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ func getForumBlocks(dbForums []dbForum, dbModerators map[uint32][]dbModerator) * | |
for _, dbForum := range dbForums { | ||
if dbForum.ForumBlockID != currentForumBlockID { | ||
forumBlock := pb.Forum_ForumBlock{ | ||
Id: dbForum.ForumBlockID, | ||
XXX_Id: dbForum.ForumBlockID, | ||
Title: dbForum.ForumBlockName, | ||
Forums: []*pb.Forum_Forum{}, | ||
} | ||
|
@@ -24,7 +24,7 @@ func getForumBlocks(dbForums []dbForum, dbModerators map[uint32][]dbModerator) * | |
|
||
for _, dbForum := range dbForums { | ||
for index := range forumBlocks { | ||
if dbForum.ForumBlockID == forumBlocks[index].GetId() { | ||
if dbForum.ForumBlockID == forumBlocks[index].GetXXX_Id() { | ||
var moderators []*pb.Forum_UserLink | ||
|
||
for _, dbModerator := range dbModerators[dbForum.ForumID] { | ||
|
@@ -36,10 +36,10 @@ func getForumBlocks(dbForums []dbForum, dbModerators map[uint32][]dbModerator) * | |
} | ||
|
||
forum := pb.Forum_Forum{ | ||
Id: dbForum.ForumID, | ||
Title: dbForum.Name, | ||
ForumDescription: dbForum.Description, | ||
Moderators: moderators, | ||
Id: dbForum.ForumID, | ||
Title: dbForum.Name, | ||
Description: dbForum.Description, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. а мы можем description по другому назвать? :) с type и description есть проблемки в свифте There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Придумаю |
||
Moderators: moderators, | ||
Stats: &pb.Forum_Forum_Stats{ | ||
TopicCount: dbForum.TopicCount, | ||
MessageCount: dbForum.MessageCount, | ||
|
@@ -77,9 +77,9 @@ func getForumTopics(dbTopics []dbForumTopic) *pb.Forum_ForumTopicsResponse { | |
for _, dbTopic := range dbTopics { | ||
var topicType pb.Forum_Topic_Type | ||
if dbTopic.TopicTypeID == 2 { | ||
topicType = pb.Forum_Topic_POLL | ||
topicType = pb.Forum_Topic_poll | ||
} else { | ||
topicType = pb.Forum_Topic_TOPIC | ||
topicType = pb.Forum_Topic_topic | ||
} | ||
|
||
topic := &pb.Forum_Topic{ | ||
|
@@ -130,9 +130,9 @@ func getTopicMessages(dbMessages []dbForumMessage, urlFormatter utils.UrlFormatt | |
|
||
var gender pb.Gender | ||
if dbMessage.Sex == 0 { | ||
gender = pb.Gender_FEMALE | ||
gender = pb.Gender_female | ||
} else { | ||
gender = pb.Gender_MALE | ||
gender = pb.Gender_male | ||
} | ||
|
||
avatar := urlFormatter.GetAvatarUrl(dbMessage.UserID, dbMessage.PhotoNumber) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
типа эта айдишка не должна светиться?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ага. Параметр технический, раньше вырезать его из json-а было очень просто, теперь приходится костыли городить.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
просто, если он не секретный, то может хрен с ним, пускай будет?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ок. Однако, надобность в аналоге
json:"-"
может возникнуть и в другом месте, мы просто скрываем проблему.golang/protobuf#52 - Open
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
протобаф планируется использовать только для отдачи клиентам (пока что - дальше хз что будет) и при необходимости можно создавать внутренние модели для конвертации и уже из них создавать протобуфные - например если будет сложный алгоритм преобразования дбшных моделей, иногда эффективней потратить больше памяти для промежуточных моделек. В таком случае не понадобится модификация генератора протомоделек) Но вообще не думаю что будет что-то настолько сложное что понадобится извращаться. ИМХО :)