-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Aditya Mukhopadhyay
committed
Jul 7, 2023
1 parent
4487538
commit c2d0a49
Showing
3 changed files
with
34 additions
and
25 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,9 @@ | ||
use graphql_parser::query; | ||
use graphql_parser::schema; | ||
use graphql_parser::{query, schema}; | ||
|
||
pub mod error_codes; | ||
|
||
pub fn load_schema(schema: &str) -> schema::Document<String> { | ||
let schema = schema::parse_schema::<String>(schema).unwrap_or_else(|err| { | ||
eprintln!("Error parsing schema: {}", err); | ||
std::process::exit(error_codes::ERROR_INVALID_SCHEMA); | ||
}); | ||
dbg!("schema: {:#?}", &schema); | ||
|
||
schema | ||
pub fn parse_schema(schema: &str) -> Result<schema::Document<String>, schema::ParseError> { | ||
schema::parse_schema::<String>(schema) | ||
} | ||
|
||
pub fn parse_query(query: &str) -> query::Document<String> { | ||
let query = query::parse_query::<String>(query).unwrap_or_else(|err| { | ||
eprintln!("Error parsing query: {}", err); | ||
std::process::exit(error_codes::ERROR_INVALID_QUERY); | ||
}); | ||
dbg!("query: {:#?}", &query); | ||
|
||
query | ||
pub fn parse_query(query: &str) -> Result<query::Document<String>, query::ParseError> { | ||
query::parse_query::<String>(query) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters