-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathschema.resolvers.go
55 lines (43 loc) · 2.02 KB
/
schema.resolvers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package indexer
// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.
import (
"context"
"fmt"
"github.com/cartridge-gg/starknet-indexer/ent"
"github.com/cartridge-gg/starknet-indexer/gql"
"github.com/dontpanicdao/caigo/types"
)
func (r *queryResolver) Node(ctx context.Context, id string) (ent.Noder, error) {
return r.client.Noder(ctx, id)
}
func (r *queryResolver) Nodes(ctx context.Context, ids []string) ([]ent.Noder, error) {
return r.client.Noders(ctx, ids)
}
func (r *queryResolver) Blocks(ctx context.Context, after *ent.Cursor, first *int, before *ent.Cursor, last *int, orderBy *ent.BlockOrder, where *gql.BlockWhereInput) (*ent.BlockConnection, error) {
return r.client.Block.Query().
Paginate(ctx, after, first, before, last,
ent.WithBlockOrder(orderBy),
)
}
func (r *queryResolver) Events(ctx context.Context, after *ent.Cursor, first *int, before *ent.Cursor, last *int, where *gql.EventWhereInput) (*ent.EventConnection, error) {
return r.client.Event.Query().
Paginate(ctx, after, first, before, last,
ent.WithEventOrder(nil),
)
}
func (r *queryResolver) Transactions(ctx context.Context, after *ent.Cursor, first *int, before *ent.Cursor, last *int, where *gql.TransactionWhereInput) (*ent.TransactionConnection, error) {
return r.client.Transaction.Query().
Paginate(ctx, after, first, before, last,
ent.WithTransactionOrder(nil),
)
}
func (r *subscriptionResolver) WatchEvent(ctx context.Context, address string, keys []*types.Felt) (<-chan *ent.Event, error) {
panic(fmt.Errorf("not implemented"))
}
// Query returns gql.QueryResolver implementation.
func (r *Resolver) Query() gql.QueryResolver { return &queryResolver{r} }
// Subscription returns gql.SubscriptionResolver implementation.
func (r *Resolver) Subscription() gql.SubscriptionResolver { return &subscriptionResolver{r} }
type queryResolver struct{ *Resolver }
type subscriptionResolver struct{ *Resolver }