line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SQL::Translator::Producer::GraphQL; |
2
|
3
|
|
|
3
|
|
61138
|
use 5.008001; |
|
3
|
|
|
|
|
13
|
|
3
|
3
|
|
|
3
|
|
13
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
59
|
|
4
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
72
|
|
5
|
3
|
|
|
3
|
|
1440
|
use SQL::Translator::Producer::DBIx::Class::File; |
|
3
|
|
|
|
|
17002
|
|
|
3
|
|
|
|
|
109
|
|
6
|
3
|
|
|
3
|
|
2294
|
use GraphQL::Plugin::Convert::DBIC; |
|
3
|
|
|
|
|
5507222
|
|
|
3
|
|
|
|
|
545
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = "0.04"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $dbic_schema_class_track = 'CLASS00000'; |
11
|
|
|
|
|
|
|
sub produce { |
12
|
3
|
|
|
3
|
0
|
1165850
|
my $translator = shift; |
13
|
3
|
|
|
|
|
50
|
my $schema = $translator->schema; |
14
|
3
|
|
|
|
|
113
|
my $dbic_schema_class = ++$dbic_schema_class_track; |
15
|
3
|
|
|
|
|
55
|
my $dbic_translator = bless { %$translator }, ref $translator; |
16
|
3
|
|
|
|
|
63
|
$dbic_translator->producer_args({ prefix => $dbic_schema_class }); |
17
|
3
|
|
|
2
|
|
143
|
eval SQL::Translator::Producer::DBIx::Class::File::produce($dbic_translator); |
|
2
|
|
|
2
|
|
80698
|
|
|
2
|
|
|
2
|
|
25
|
|
|
2
|
|
|
2
|
|
541
|
|
|
2
|
|
|
2
|
|
14647
|
|
|
2
|
|
|
2
|
|
5
|
|
|
2
|
|
|
2
|
|
37
|
|
|
2
|
|
|
2
|
|
9
|
|
|
2
|
|
|
2
|
|
3
|
|
|
2
|
|
|
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phql( |
20
|
3
|
|
|
3
|
|
34
|
sub { $dbic_schema_class->connect } |
21
|
3
|
|
|
|
|
38
|
); |
22
|
3
|
|
|
|
|
634744
|
$converted->{schema}->to_doc; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=encoding utf-8 |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
SQL::Translator::Producer::GraphQL - GraphQL schema producer for SQL::Translator |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=begin markdown |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# PROJECT STATUS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
| OS | Build status | |
36
|
|
|
|
|
|
|
|:-------:|--------------:| |
37
|
|
|
|
|
|
|
| Linux | [![Build Status](https://travis-ci.org/graphql-perl/SQL-Translator-Producer-GraphQL.svg?branch=master)](https://travis-ci.org/graphql-perl/SQL-Translator-Producer-GraphQL) | |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
[![CPAN version](https://badge.fury.io/pl/SQL-Translator-Producer-GraphQL.svg)](https://metacpan.org/pod/SQL::Translator::Producer::GraphQL) |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=end markdown |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SYNOPSIS |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
use SQL::Translator; |
46
|
|
|
|
|
|
|
use SQL::Translator::Producer::GraphQL; |
47
|
|
|
|
|
|
|
my $t = SQL::Translator->new( parser => '...' ); |
48
|
|
|
|
|
|
|
$t->producer('GraphQL'); |
49
|
|
|
|
|
|
|
$t->translate; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 DESCRIPTION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This module will produce a L<GraphQL::Schema> from the given |
54
|
|
|
|
|
|
|
L<SQL::Translator::Schema>. It does this by first |
55
|
|
|
|
|
|
|
turning it into a L<DBIx::Class::Schema> using |
56
|
|
|
|
|
|
|
L<SQL::Translator::Producer::DBIx::Class::File>, then passing it to |
57
|
|
|
|
|
|
|
L<GraphQL::Plugin::Convert::DBIC/to_graphql>. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 ARGUMENTS |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Currently none. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 DEBUGGING |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
To debug, set environment variable C<GRAPHQL_DEBUG> to a true value. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 AUTHOR |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Ed J, C<< <etj at cpan.org> >> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Based heavily on L<SQL::Translator::Producer::DBIxSchemaDSL>. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 LICENSE |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Copyright (C) Ed J |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
78
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |