-
-
Notifications
You must be signed in to change notification settings - Fork 725
/
IntType.cs
56 lines (50 loc) · 1.5 KB
/
IntType.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using HotChocolate.Language;
using HotChocolate.Properties;
#nullable enable
namespace HotChocolate.Types
{
/// <summary>
/// The Int scalar type represents a signed 32‐bit numeric non‐fractional
/// value. Response formats that support a 32‐bit integer or a number type
/// should use that type to represent this scalar.
///
/// http://facebook.github.io/graphql/June2018/#sec-Int
/// </summary>
[SpecScalar]
public sealed class IntType
: IntegerTypeBase<int>
{
public IntType()
: this(ScalarNames.Int,
TypeResources.IntType_Description,
bind: BindingBehavior.Implicit)
{
}
public IntType(int min, int max)
: this(ScalarNames.Int,
TypeResources.IntType_Description,
min,
max,
BindingBehavior.Implicit)
{
}
public IntType(
NameString name,
string? description = null,
int min = int.MinValue,
int max = int.MaxValue,
BindingBehavior bind = BindingBehavior.Explicit)
: base(name, min, max, bind)
{
Description = description;
}
protected override int ParseLiteral(IntValueNode valueSyntax)
{
return valueSyntax.ToInt32();
}
protected override IntValueNode ParseValue(int runtimeValue)
{
return new IntValueNode(runtimeValue);
}
}
}