From 422f33eb2c77b4bd0f285542757f536411b8ae63 Mon Sep 17 00:00:00 2001 From: Charles Iliya Krempeaux Date: Thu, 8 Aug 2024 09:07:30 -0700 Subject: [PATCH] mstdn/ent.Poll --- ent/poll.go | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/ent/poll.go b/ent/poll.go index b998be1..b44ce17 100644 --- a/ent/poll.go +++ b/ent/poll.go @@ -1,20 +1,25 @@ package ent import ( + "github.com/reiver/go-json" "github.com/reiver/go-jsonint" "github.com/reiver/go-opt" "github.com/reiver/go-nul" ) type Poll struct { - ID opt.Optional[string] `json:"id"` - ExpiresAt nul.Nullable[string] `json:"expires_at"` - Expired opt.Optional[bool] `json:"expired"` - Multiple opt.Optional[bool] `json:"multiple"` - VotesCount opt.Optional[jsonint.Int] `json:"votes_count"` - VotersCount opt.Optional[jsonint.Int] `json:"voters_count"` - Options []PollOption `json:"options"` - Emojis []CustomEmoji `json:"emojis"` - Voted opt.Optional[bool] `json:"voted"` - OwnVotes []jsonint.Int `json:"own_votes"` + ID opt.Optional[string] `json:"id,omitempty"` + ExpiresAt nul.Nullable[string] `json:"expires_at,omitempty"` + Expired opt.Optional[bool] `json:"expired,omitempty"` + Multiple opt.Optional[bool] `json:"multiple,omitempty"` + VotesCount opt.Optional[jsonint.Int] `json:"votes_count,omitempty"` + VotersCount opt.Optional[jsonint.Int] `json:"voters_count,omitempty"` + Options []PollOption `json:"options,omitempty"` + Emojis []CustomEmoji `json:"emojis,omitempty"` + Voted opt.Optional[bool] `json:"voted,omitempty"` + OwnVotes []jsonint.Int `json:"own_votes,omitempty"` +} + +func (receiver *Poll) MarshalJSON() ([]byte, error) { + return json.Marshal(*receiver) }