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,19 +108,23 @@ 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.RawString(prefix)
out.String(in.ID) 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\":" const prefix string = ",\"pubkey\":"
out.RawString(prefix) out.RawString(prefix)
out.String(in.PubKey) out.String(in.PubKey)
} }
{
const prefix string = ",\"created_at\":"
out.RawString(prefix)
out.Int64(int64(in.CreatedAt))
} }
{ {
const prefix string = ",\"kind\":" const prefix string = ",\"kind\":"
@@ -162,10 +164,12 @@ func easyjsonF642ad3eEncodeGithubComNbdWtfGoNostr(out *jwriter.Writer, in Event)
out.String(in.Content) out.String(in.Content)
} }
{ {
if in.Sig != "" {
const prefix string = ",\"sig\":" const prefix string = ",\"sig\":"
out.RawString(prefix) out.RawString(prefix)
out.String(in.Sig) out.String(in.Sig)
} }
}
{ {
for key, value := range in.extra { for key, value := range in.extra {
out.RawString(",\"" + key + "\":") out.RawString(",\"" + key + "\":")

View File

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