Documentation
¶
Overview ¶
Package graphfx is the glue between nexus and github.com/paulmanoni/go-graph. Drop graphfx.Module into your fx.New(...), wrap your resolver constructors with AsQuery/AsMutation/AsSubscription, and mount with ServeAt.
As of go-graph v1.2.4, graphfx introspects every resolver after mounting and enriches the nexus registry with: return type, per-arg Required flag and default values, per-arg validator metadata (from graph.WithArgValidator), per-resolver named middleware chain (from graph.WithNamedMiddleware), and deprecation info (from graph.WithDeprecated). Dashboards consume this without the user declaring anything separately.
Typical usage:
fx.New(
fxmod.Module,
graphfx.Module,
fx.Provide(
graphfx.AsQuery(NewGetAllAdverts),
graphfx.AsMutation(NewCreateAdvert),
),
graphfx.ServeAt("adverts", "/graphql",
graphfx.Describe("Job adverts catalog"),
graphfx.UseDefaults(),
),
)
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Module = fx.Module("graphfx", fx.Provide(provideBundle), )
Module provides *Bundle into the fx graph. A Bundle holds both the assembled *graph.SchemaBuilder and the raw resolver slices, so ServeAt can introspect every resolver after mount.
Functions ¶
func AsQuery ¶
AsQuery annotates a constructor so Fx stores its result in the "query_fields" value group that SchemaBuilderParams consumes.
func AsSubscription ¶
AsSubscription — like AsQuery, for subscriptions.
Types ¶
type Bundle ¶
type Bundle struct {
Builder *graph.SchemaBuilder
Queries []graph.QueryField
Mutations []graph.MutationField
Subscriptions []graph.SubscriptionField
}
Bundle carries both the schema builder and the raw field slices so ServeAt can introspect each resolver after mount. You normally don't construct this yourself; graphfx.Module provides it.
type Opt ¶
type Opt func(*mountConfig)
Opt configures a ServeAt call.
func UseDefaults ¶
func UseDefaults() Opt
UseDefaults attaches the default database, cache, and queue (if registered).