Fauna v10 .NET/C# Driver 1.0.1
 
Loading...
Searching...
No Matches
TokenType.cs
Go to the documentation of this file.
1namespace Fauna.Serialization;
2
6public enum TokenType
7{
9 None,
10
15
20
24 EndPage,
25
29 EndRef,
30
35
38
40 String,
42 Bytes,
43
45 Int,
47 Long,
49 Double,
50
52 Date,
54 Time,
55
57 True,
59 False,
60
62 Null,
63
65 Module,
66
69}
70
74public static class TokenTypeExtensions
75{
82 public static FaunaType GetFaunaType(this TokenType tokenType)
83 {
84 switch (tokenType)
85 {
86 case TokenType.StartObject:
87 case TokenType.EndObject:
88 return FaunaType.Object;
89
90 case TokenType.StartArray:
91 case TokenType.EndArray:
92 return FaunaType.Array;
93
94 case TokenType.StartPage:
95 case TokenType.EndPage:
96 return FaunaType.Set;
97
98 case TokenType.StartRef:
99 case TokenType.EndRef:
100 return FaunaType.Ref;
101
102 case TokenType.StartDocument:
103 case TokenType.EndDocument:
104 return FaunaType.Document;
105
106 case TokenType.String:
107 return FaunaType.String;
108 case TokenType.Bytes:
109 return FaunaType.Bytes;
110 case TokenType.Int:
111 return FaunaType.Int;
112 case TokenType.Long:
113 return FaunaType.Long;
114 case TokenType.Double:
115 return FaunaType.Double;
116 case TokenType.Date:
117 return FaunaType.Date;
118 case TokenType.Time:
119 return FaunaType.Time;
120 case TokenType.True:
121 case TokenType.False:
122 return FaunaType.Boolean;
123 case TokenType.Null:
124 return FaunaType.Null;
125 case TokenType.EventSource:
126 return FaunaType.Stream;
127 case TokenType.Module:
128 return FaunaType.Module;
129 default:
130 throw new ArgumentException($"No associated FaunaType for TokenType: {tokenType}");
131 }
132 }
133}
System.ArgumentException ArgumentException
FaunaType
An enum representing possible Fauna types.
Definition FaunaType.cs:7
@ Bytes
A Fauna byte array, stored as a base-64 encoded string.
TokenType
Enumerates the types of tokens used in Fauna serialization.
Definition TokenType.cs:7
@ StartRef
The token type is the start of a Fauna ref.
@ EndArray
The token type is the end of a Fauna array.
@ EndObject
The token type is the end of a Fauna object.
@ EndRef
The token type is the end of a Fauna ref.
@ StartDocument
The token type is the start of a Fauna document.
@ EndPage
The token type is the end of a Fauna set (a.k.a. page).
@ StartPage
The token type is the start of a Fauna set (a.k.a. page).
@ None
There is no value. This is the default token type if no data has been read by the T:Fauna....
@ EventSource
The token type is the Fauna event source token.
@ StartArray
The token type is the start of a Fauna array.
@ FieldName
The token type is a Fauna property name.
@ StartObject
The token type is the start of a Fauna object.
@ EndDocument
The token type is the end of a Fauna document.
@ True
The token type is the Fauna literal true.
@ False
The token type is the Fauna literal false.