Skip to content

Commit b186d98

Browse files
authored
feat(network-subgraphs): Add idAsString field (#994)
Added new field to `Stream` entity: `Stream#idAsString`. It has same value as in the `id` field. The field allows us do to substring queries for the field id (by using `idAsString_contains` where clause). This feature is needed e.g. in streamr-dev/network#3132.
1 parent 454e428 commit b186d98

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

packages/network-subgraphs/schema.graphql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ type StreamPermission @entity {
3535
type Stream @entity {
3636
"stream ID = 'creator address'/'path' where path can be any string"
3737
id: ID!
38+
"This field has the same value as the ID field. It enables us to perform substring queries on the id field using the idAsString_contains where clause"
39+
idAsString: String! @index
3840
"Stream metadata JSON"
3941
metadata: String!
4042
"Permissions that each Ethereum address owns to this stream"

packages/network-subgraphs/src/streamRegistry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export function handleStreamCreation(event: StreamCreated): void {
2424
return
2525
}
2626
let stream = new Stream(event.params.id)
27+
stream.idAsString = event.params.id,
2728
stream.metadata = event.params.metadata
2829
stream.createdAt = event.block.timestamp
2930
stream.updatedAt = event.block.timestamp

0 commit comments

Comments
 (0)