diff options
Diffstat (limited to 'axon.go')
| -rw-r--r-- | axon.go | 22 |
1 files changed, 22 insertions, 0 deletions
| @@ -29,6 +29,28 @@ type Tag struct { | |||
| 29 | Values []string `msgpack:"values" json:"values"` | 29 | Values []string `msgpack:"values" json:"values"` |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | // TagFilter selects events that have a tag with the given name and any of the | ||
| 33 | // given values. An empty Values slice matches any value. | ||
| 34 | type TagFilter struct { | ||
| 35 | Name string `msgpack:"name"` | ||
| 36 | Values []string `msgpack:"values"` | ||
| 37 | } | ||
| 38 | |||
| 39 | // Filter selects a subset of events. All non-empty fields are ANDed together; | ||
| 40 | // multiple entries within a slice field are ORed. | ||
| 41 | // | ||
| 42 | // IDs and Authors support prefix matching: a []byte shorter than 32 bytes | ||
| 43 | // matches any event whose ID (or pubkey) starts with those bytes. | ||
| 44 | type Filter struct { | ||
| 45 | IDs [][]byte `msgpack:"ids"` | ||
| 46 | Authors [][]byte `msgpack:"authors"` | ||
| 47 | Kinds []uint16 `msgpack:"kinds"` | ||
| 48 | Since int64 `msgpack:"since"` // inclusive lower bound on created_at | ||
| 49 | Until int64 `msgpack:"until"` // inclusive upper bound on created_at | ||
| 50 | Limit int32 `msgpack:"limit"` // max events to return (0 = no limit) | ||
| 51 | Tags []TagFilter `msgpack:"tags"` | ||
| 52 | } | ||
| 53 | |||
| 32 | // Event is the core Axon data structure. All fields use their wire types. | 54 | // Event is the core Axon data structure. All fields use their wire types. |
| 33 | // id, pubkey and sig are raw 32/64-byte slices, not hex. | 55 | // id, pubkey and sig are raw 32/64-byte slices, not hex. |
| 34 | // content is opaque bytes (msgpack bin type). | 56 | // content is opaque bytes (msgpack bin type). |
