Add filter struct - #42
Conversation
|
|
||
| type Filter struct { | ||
| AccountData struct { | ||
| Limit int `json:"limit"` |
There was a problem hiding this comment.
Maybe this should be a * int so we can handle 0 more intelligently?
There was a problem hiding this comment.
How does this change handling of the 0?
There was a problem hiding this comment.
If limit is unspecified then int will default to 0 while *int will default to nil, this would then allow us (elsewhere) to differentiate between the two cases.
Specifying a limit of 0 feels a bit weird, but it should probably not just mean use the default limit, which is what would happen if we use int here.
There was a problem hiding this comment.
Ah, that makes sense, yes.
There was a problem hiding this comment.
This should apply to all limits in this struct, doesn't it?
| NotSenders []string `json:"not_senders,omitempty"` | ||
| NotTypes []string `json:"not_types,omitempty"` | ||
| Senders []string `json:"senders,omitempty"` | ||
| Types []string `json:"types,omitempty"` |
There was a problem hiding this comment.
This struct comes up a lot, should it not be pulled up into a separate thing? I think in synapse I called the top most struct FilterCollection and then Filter for the sub struct
There was a problem hiding this comment.
yeah sure... If I had written it all by hand, I would have probably noticed that, I generated the struct from the json schema 😄
There was a problem hiding this comment.
Haha, fair. I'm imaging that at some point we may want to write functions that take the sub filters as an argument, instead of manually writing the filtering code for each of account data, ephemeral, events, etc
No description provided.