omit id, pubkey and sig in jsonifying event and they're not present.

This commit is contained in:
fiatjaf
2024-04-25 18:14:39 -03:00
parent ed62361f1b
commit 2a85932a4f
2 changed files with 20 additions and 18 deletions

View File

@@ -1,5 +1,3 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package nostr package nostr
import ( import (
@@ -110,20 +108,24 @@ func easyjsonF642ad3eEncodeGithubComNbdWtfGoNostr(out *jwriter.Writer, in Event)
first := true first := true
_ = first _ = first
{ {
const prefix string = ",\"id\":" const prefix string = "\"created_at\":"
out.RawString(prefix[1:])
out.String(in.ID)
}
{
const prefix string = ",\"pubkey\":"
out.RawString(prefix)
out.String(in.PubKey)
}
{
const prefix string = ",\"created_at\":"
out.RawString(prefix) out.RawString(prefix)
out.Int64(int64(in.CreatedAt)) out.Int64(int64(in.CreatedAt))
} }
{
if in.ID != "" {
const prefix string = ",\"id\":"
out.RawString(prefix)
out.String(in.ID)
}
}
{
if in.PubKey != "" {
const prefix string = ",\"pubkey\":"
out.RawString(prefix)
out.String(in.PubKey)
}
}
{ {
const prefix string = ",\"kind\":" const prefix string = ",\"kind\":"
out.RawString(prefix) out.RawString(prefix)
@@ -162,9 +164,11 @@ func easyjsonF642ad3eEncodeGithubComNbdWtfGoNostr(out *jwriter.Writer, in Event)
out.String(in.Content) out.String(in.Content)
} }
{ {
const prefix string = ",\"sig\":" if in.Sig != "" {
out.RawString(prefix) const prefix string = ",\"sig\":"
out.String(in.Sig) out.RawString(prefix)
out.String(in.Sig)
}
} }
{ {
for key, value := range in.extra { for key, value := range in.extra {

View File

@@ -1,5 +1,3 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package nostr package nostr
import ( import (