swell/parser
Types
Argument (name: value)
pub type Argument {
Argument(name: String, value: ArgumentValue)
}
Constructors
-
Argument(name: String, value: ArgumentValue)
Argument value types
pub type ArgumentValue {
IntValue(String)
FloatValue(String)
StringValue(String)
BooleanValue(Bool)
NullValue
EnumValue(String)
ListValue(List(ArgumentValue))
ObjectValue(List(#(String, ArgumentValue)))
VariableValue(String)
}
Constructors
-
IntValue(String) -
FloatValue(String) -
StringValue(String) -
BooleanValue(Bool) -
NullValue -
EnumValue(String) -
ListValue(List(ArgumentValue)) -
ObjectValue(List(#(String, ArgumentValue))) -
VariableValue(String)
GraphQL Operation
pub type Operation {
Query(SelectionSet)
NamedQuery(
name: String,
variables: List(Variable),
selections: SelectionSet,
)
Mutation(SelectionSet)
NamedMutation(
name: String,
variables: List(Variable),
selections: SelectionSet,
)
Subscription(SelectionSet)
NamedSubscription(
name: String,
variables: List(Variable),
selections: SelectionSet,
)
FragmentDefinition(
name: String,
type_condition: String,
selections: SelectionSet,
)
}
Constructors
-
Query(SelectionSet) -
NamedQuery( name: String, variables: List(Variable), selections: SelectionSet, ) -
Mutation(SelectionSet) -
NamedMutation( name: String, variables: List(Variable), selections: SelectionSet, ) -
Subscription(SelectionSet) -
NamedSubscription( name: String, variables: List(Variable), selections: SelectionSet, ) -
FragmentDefinition( name: String, type_condition: String, selections: SelectionSet, )
pub type ParseError {
UnexpectedToken(lexer.Token, String)
UnexpectedEndOfInput(String)
LexerError(lexer.LexerError)
}
Constructors
-
UnexpectedToken(lexer.Token, String) -
UnexpectedEndOfInput(String) -
LexerError(lexer.LexerError)
Selection (field or fragment)
pub type Selection {
Field(
name: String,
alias: option.Option(String),
arguments: List(Argument),
selections: List(Selection),
)
FragmentSpread(name: String)
InlineFragment(
type_condition: option.Option(String),
selections: List(Selection),
)
}
Constructors
-
Field( name: String, alias: option.Option(String), arguments: List(Argument), selections: List(Selection), ) -
FragmentSpread(name: String) -
InlineFragment( type_condition: option.Option(String), selections: List(Selection), )
Values
pub fn parse(source: String) -> Result(Document, ParseError)
Parse a GraphQL query string into a Document