Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var FilterEqual = Equal
Deprecated: stutters: use Equal instead
Functions ¶
func CopyUnmarshalFilterToFilter ¶
func CopyUnmarshalFilterToFilter(uf *UnmarshalingFilter, f *T) (err error)
Types ¶
type T ¶
type T struct { IDs tag.T `json:"ids,omitempty"` Kinds kinds.T `json:"kinds,omitempty"` Authors tag.T `json:"authors,omitempty"` Tags TagMap `json:"-,omitempty"` Since *timestamp.Tp `json:"since,omitempty"` Until *timestamp.Tp `json:"until,omitempty"` Limit *int `json:"limit,omitempty"` Search string `json:"search,omitempty"` }
T is a query where one or all elements can be filled in.
Most of it is normal stuff but the Tags are a special case because the Go encode/json will not do what the specification requires, which is to unwrap the tag as fields.
Tags: {K1: val1, K2: val2)
must be changed to
K1: val1 K2: val2
For this reason in the original nbd-wdf/go-nostr special handling is created using the easyjson library that allows this '-' json tag to indicate to promote the key/value pairs inside to the same level of the object and not bundled inside another key.
Because we have a native key/value type designed for ordered object JSON serialization we just give it special treatment in the ToObject function.
The json tags are not here because they are worthless for unmarshalling and unnecessary for marshaling. They appear in the ToObject because all of them are optional fields.
For the simplified handling of unmarshaling this JSON abomination this struct is redefined so that the Tags fields are elaborated concretely and then the populated tags are put into the map as they are expected to be.
func (*T) MarshalJSON ¶
func (*T) UnmarshalJSON ¶
UnmarshalJSON correctly unpacks a JSON encoded T rolling up the Tags as they should be.
type UnmarshalingFilter ¶
type UnmarshalingFilter struct { IDs tag.T `json:"ids,omitempty"` Kinds kinds.T `json:"kinds,omitempty"` Authors tag.T `json:"authors,omitempty"` Ta tag.T `json:"#a,omitempty"` Tb tag.T `json:"#b,omitempty"` Tc tag.T `json:"#c,omitempty"` Td tag.T `json:"#d,omitempty"` Te tag.T `json:"#e,omitempty"` Tf tag.T `json:"#f,omitempty"` Tg tag.T `json:"#g,omitempty"` Th tag.T `json:"#h,omitempty"` Ti tag.T `json:"#i,omitempty"` Tj tag.T `json:"#j,omitempty"` Tk tag.T `json:"#k,omitempty"` Tl tag.T `json:"#l,omitempty"` Tm tag.T `json:"#m,omitempty"` Tn tag.T `json:"#n,omitempty"` To tag.T `json:"#o,omitempty"` Tp tag.T `json:"#p,omitempty"` Tq tag.T `json:"#q,omitempty"` Tr tag.T `json:"#r,omitempty"` Ts tag.T `json:"#s,omitempty"` Tt tag.T `json:"#t,omitempty"` Tu tag.T `json:"#u,omitempty"` Tv tag.T `json:"#v,omitempty"` Tw tag.T `json:"#w,omitempty"` Tx tag.T `json:"#x,omitempty"` Ty tag.T `json:"#y,omitempty"` TA tag.T `json:"#A,omitempty"` TB tag.T `json:"#B,omitempty"` TC tag.T `json:"#C,omitempty"` TD tag.T `json:"#D,omitempty"` TE tag.T `json:"#E,omitempty"` TF tag.T `json:"#F,omitempty"` TG tag.T `json:"#G,omitempty"` TH tag.T `json:"#H,omitempty"` TI tag.T `json:"#I,omitempty"` TJ tag.T `json:"#J,omitempty"` TK tag.T `json:"#K,omitempty"` TL tag.T `json:"#L,omitempty"` TM tag.T `json:"#M,omitempty"` TN tag.T `json:"#N,omitempty"` TO tag.T `json:"#O,omitempty"` TP tag.T `json:"#P,omitempty"` TQ tag.T `json:"#Q,omitempty"` TR tag.T `json:"#R,omitempty"` TS tag.T `json:"#S,omitempty"` TT tag.T `json:"#T,omitempty"` TU tag.T `json:"#U,omitempty"` TV tag.T `json:"#V,omitempty"` TW tag.T `json:"#W,omitempty"` TX tag.T `json:"#X,omitempty"` TY tag.T `json:"#Y,omitempty"` Since *timestamp.Tp `json:"since,omitempty"` Until *timestamp.Tp `json:"until,omitempty"` Limit *int `json:"limit,omitempty"` Search string `json:"search,omitempty"` }