Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions packages/schema/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,11 @@ impl<'a> TypeInfo<'a> {
}
}

#[derive(Debug)]
#[derive(Debug, Default)]
pub struct Query<'a> {
l: std::marker::PhantomData<&'a ()>,
}

impl<'a> Query<'a> {
pub fn new() -> Self {
Self {
l: std::marker::PhantomData {},
}
}
}

impl<'b> juniper::GraphQLTypeAsync<juniper::DefaultScalarValue> for Query<'b> {
fn resolve_field_async<'a>(
&'a self,
Expand Down Expand Up @@ -185,7 +177,7 @@ pub async fn build<'a>(config: &crate::Config) -> Schema<'a> {
};

juniper::RootNode::new_with_info(
Query::new(),
Query::default(),
juniper::EmptyMutation::<crate::context::Context>::new(),
juniper::EmptySubscription::<crate::context::Context>::new(),
TypeInfo::new("Query".into(), fields),
Expand Down
3 changes: 3 additions & 0 deletions tests/data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
insert into t1 (id) values (1);
insert into t2 (id, c1, c2) values (1, 2, 3);
insert into t2 (id, c1, c2) values (2, 4, null);
14 changes: 12 additions & 2 deletions tests/introspection.test.expected.graphql
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
type Query {
t1: Int!
t2: Int!
t1: T1!
t2: T2!
}

type T1 {
id: Int!
}

type T2 {
id: Int!
c1: Int!
c2: Int!
}
6 changes: 5 additions & 1 deletion tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,11 @@ reset_database () {
if [ -z "$keep_database" ]; then
psql="PGPASSWORD=\"$PGQL_DB_PASSWORD\" psql -h \"$PGQL_DB_HOST\" -U \"$PGQL_DB_USER\" -w -v ON_ERROR_STOP=1 -q"
echo "drop database if exists $PGQL_DB_NAME; create database $PGQL_DB_NAME" | eval "$psql"
cat ./schema.sql | envsubst | eval "$psql" -d "$PGQL_DB_NAME"
{
echo "begin;"
cat ./schema.sql ./data.sql
echo "commit;"
} | envsubst | eval "$psql" -d "$PGQL_DB_NAME"
fi
}

Expand Down
11 changes: 9 additions & 2 deletions tests/schema.sql
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
create table t1 (id int not null primary key);
create table t2 (id int not null primary key);
create table t1 (
id int not null primary key
);

create table t2 (
id int not null primary key,
c1 int not null,
c2 int
);