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"
|
2023-07-12 17:35:02 -06:00
|
|
|
"go.sour.is/pkg/gql"
|
|
|
|
"go.sour.is/pkg/gql/resolver"
|
|
|
|
|
2023-02-26 22:33:01 -07:00
|
|
|
"go.sour.is/ev/app/msgbus"
|
|
|
|
"go.sour.is/ev/app/salty"
|
|
|
|
"go.sour.is/ev/internal/graph/generated"
|
2023-07-22 08:52:15 -06:00
|
|
|
gql_es "go.sour.is/ev/pkg/gql"
|
2022-08-23 21:24:13 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
type Resolver struct {
|
|
|
|
msgbus.MsgbusResolver
|
|
|
|
salty.SaltyResolver
|
2023-07-22 08:52:15 -06:00
|
|
|
gql_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)
|
2023-07-22 08:52:15 -06:00
|
|
|
var _ gql_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")
|
|
|
|
}
|
2023-04-02 16:45:17 -06:00
|
|
|
func (*noop) Posts(ctx context.Context, name, tag string, paging *gql.PageInput) (*gql.Connection, error) {
|
2022-08-23 21:24:13 -06:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
func (*noop) SaltyUser(ctx context.Context, nick string) (*salty.SaltyUser, error) {
|
|
|
|
panic("not implemented")
|
|
|
|
}
|
2023-04-02 16:45:17 -06:00
|
|
|
func (*noop) PostAdded(ctx context.Context, name, tag string, after int64) (<-chan *msgbus.PostEvent, error) {
|
2022-08-23 21:24:13 -06:00
|
|
|
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")
|
|
|
|
}
|
2023-07-22 08:52:15 -06:00
|
|
|
func (*noop) EventAdded(ctx context.Context, streamID string, after int64) (<-chan *gql_es.Event, error) {
|
2022-09-04 08:34:22 -06:00
|
|
|
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")
|
|
|
|
}
|