2022-08-23 21:24:13 -06:00
|
|
|
package gql
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-10-30 09:18:08 -06:00
|
|
|
"github.com/99designs/gqlgen/graphql"
|
2022-08-23 21:24:13 -06:00
|
|
|
"github.com/sour-is/ev/app/msgbus"
|
|
|
|
"github.com/sour-is/ev/app/salty"
|
|
|
|
"github.com/sour-is/ev/internal/graph/generated"
|
2022-09-04 08:34:22 -06:00
|
|
|
"github.com/sour-is/ev/pkg/es"
|
2022-08-23 21:24:13 -06:00
|
|
|
"github.com/sour-is/ev/pkg/gql"
|
2022-11-23 13:51:55 -07:00
|
|
|
"github.com/sour-is/ev/pkg/gql/resolver"
|
2022-08-23 21:24:13 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
type Resolver struct {
|
|
|
|
msgbus.MsgbusResolver
|
|
|
|
salty.SaltyResolver
|
2022-09-04 08:34:22 -06:00
|
|
|
es.EventResolver
|
2022-08-23 21:24:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// Query returns generated.QueryResolver implementation.
|
|
|
|
func (r *Resolver) Query() generated.QueryResolver { return r }
|
|
|
|
|
|
|
|
// Query returns generated.QueryResolver implementation.
|
|
|
|
func (r *Resolver) Mutation() generated.MutationResolver { return r }
|
|
|
|
|
|
|
|
// Subscription returns generated.SubscriptionResolver implementation.
|
|
|
|
func (r *Resolver) Subscription() generated.SubscriptionResolver { return r }
|
|
|
|
|
2022-11-23 13:51:55 -07:00
|
|
|
// func (r *Resolver) isResolver() {}
|
|
|
|
func (r *Resolver) ExecutableSchema() graphql.ExecutableSchema {
|
|
|
|
return generated.NewExecutableSchema(generated.Config{Resolvers: r})
|
2022-08-23 21:24:13 -06:00
|
|
|
}
|
2022-11-23 13:51:55 -07:00
|
|
|
func (r *Resolver) BaseResolver() resolver.IsResolver {
|
|
|
|
return &noop{}
|
2022-08-23 21:24:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type noop struct{}
|
|
|
|
|
|
|
|
var _ msgbus.MsgbusResolver = (*noop)(nil)
|
|
|
|
var _ salty.SaltyResolver = (*noop)(nil)
|
2022-09-04 08:34:22 -06:00
|
|
|
var _ es.EventResolver = (*noop)(nil)
|
2022-08-23 21:24:13 -06:00
|
|
|
|
2022-11-23 13:51:55 -07:00
|
|
|
func (*noop) IsResolver() {}
|
2022-08-23 21:24:13 -06:00
|
|
|
func (*noop) CreateSaltyUser(ctx context.Context, nick string, pubkey string) (*salty.SaltyUser, error) {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
func (*noop) Posts(ctx context.Context, streamID string, paging *gql.PageInput) (*gql.Connection, error) {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
func (*noop) SaltyUser(ctx context.Context, nick string) (*salty.SaltyUser, error) {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
func (*noop) PostAdded(ctx context.Context, streamID string, after int64) (<-chan *msgbus.PostEvent, error) {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
2022-09-04 08:34:22 -06:00
|
|
|
func (*noop) Events(ctx context.Context, streamID string, paging *gql.PageInput) (*gql.Connection, error) {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
func (*noop) EventAdded(ctx context.Context, streamID string, after int64) (<-chan *es.GQLEvent, error) {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
2022-11-20 10:13:36 -07:00
|
|
|
func (*noop) TruncateStream(ctx context.Context, streamID string, index int64) (bool, error) {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|