Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
GraphQL::Plugin::ConveUser)Contributed Perl DocumenGraphQL::Plugin::Convert(3)

NAME
       GraphQL::Plugin::Convert	- GraphQL plugin API abstract class

SYNOPSIS
	 package GraphQL::Plugin::Convert::DBIC;
	 use Moo;
	 extends qw(GraphQL::Plugin::Convert);
	 # ...

	 package main;
	 use Mojolicious::Lite;
	 use Schema;
	 use GraphQL::Plugin::Convert::DBIC;
	 helper	db => sub { Schema->connect('dbi:SQLite:test.db') };
	 my $converted = GraphQL::Plugin::Convert::DBIC->to_graphql(sub	{ app->db });
	 plugin	GraphQL	=> {
	   map { $_ => $converted->{$_}	}
	     qw(schema resolver	root_value subscribe_resolver)
	 };

	 # OR, for knowledgeable consumers of GraphQL::Plugin::Convert APIs:
	 package main;
	 use Mojolicious::Lite;
	 use Schema;
	 helper	db => sub { Schema->connect('dbi:SQLite:test.db') };
	 plugin	GraphQL	=> { convert =>	[ 'DBIC', sub {	app->db	} ] };

DESCRIPTION
       Abstract	class for other	GraphQL	type classes to	inherit	from and
       implement.

METHODS
   to_graphql(@values)
       When called with	suitable values	(as defined by the implementing
       class), will return a hash-ref with these keys:

       schema
	   A GraphQL::Schema.

       resolver
	   A code-ref suitable for using as a resolver by "execute" in
	   GraphQL::Execution. Optional.

       root_value
	   A hash-ref suitable for using as a $root_value by "execute" in
	   GraphQL::Execution. Optional.

       subscribe_resolver
	   A code-ref suitable for using as a $subscribe_resolver by
	   "subscribe" in GraphQL::Subscription. Optional.

   from_graphql
       When called with	a hash-ref shaped as above, with at least a "schema"
       key with	a GraphQL::Schema, returns some	value(s). Optional to
       implement.  If the plugin does implement	this, allows conversion	from a
       GraphQL schema to that plugin's domain.

perl v5.32.1			  2021-02-02	   GraphQL::Plugin::Convert(3)

NAME | SYNOPSIS | DESCRIPTION | METHODS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=GraphQL::Plugin::Convert&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help