-
Notifications
You must be signed in to change notification settings - Fork 533
Expand file tree
/
Copy pathCosmosNull.cs
More file actions
126 lines (105 loc) · 3.53 KB
/
CosmosNull.cs
File metadata and controls
126 lines (105 loc) · 3.53 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace Microsoft.Azure.Cosmos.CosmosElements
{
#nullable enable
using System;
using Microsoft.Azure.Cosmos.Json;
using Microsoft.Azure.Cosmos.Query.Core.Monads;
#if INTERNAL
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
#pragma warning disable SA1600 // Elements should be documented
public
#else
internal
#endif
sealed class CosmosNull : CosmosElement, IEquatable<CosmosNull>, IComparable<CosmosNull>
{
private const uint Hash = 448207988;
private static readonly CosmosNull Singleton = new CosmosNull();
private CosmosNull()
: base()
{
}
public override void Accept(ICosmosElementVisitor cosmosElementVisitor)
{
cosmosElementVisitor.Visit(this);
}
public override TResult Accept<TResult>(ICosmosElementVisitor<TResult> cosmosElementVisitor)
{
return cosmosElementVisitor.Visit(this);
}
public override TResult Accept<TArg, TResult>(ICosmosElementVisitor<TArg, TResult> cosmosElementVisitor, TArg input)
{
return cosmosElementVisitor.Visit(this, input);
}
public override bool Equals(CosmosElement? cosmosElement)
{
return cosmosElement is CosmosNull cosmosNull && this.Equals(cosmosNull);
}
public bool Equals(CosmosNull? cosmosNull)
{
if (cosmosNull is null)
{
return false;
}
return true;
}
public static CosmosNull Create()
{
return CosmosNull.Singleton;
}
public override int GetHashCode()
{
return (int)Hash;
}
public override void WriteTo(IJsonWriter jsonWriter)
{
jsonWriter.WriteNullValue();
}
public static new CosmosNull CreateFromBuffer(ReadOnlyMemory<byte> buffer)
{
return CosmosElement.CreateFromBuffer<CosmosNull>(buffer);
}
public static new CosmosNull Parse(string json)
{
return CosmosElement.Parse<CosmosNull>(json);
}
public static bool TryCreateFromBuffer(
ReadOnlyMemory<byte> buffer,
out CosmosNull cosmosNull)
{
return CosmosElement.TryCreateFromBuffer<CosmosNull>(buffer, out cosmosNull);
}
public static bool TryParse(
string json,
out CosmosNull cosmosNull)
{
return CosmosElement.TryParse<CosmosNull>(json, out cosmosNull);
}
public int CompareTo(CosmosNull? other)
{
if (other is null)
{
return 1;
}
return 0;
}
public static new class Monadic
{
public static TryCatch<CosmosNull> CreateFromBuffer(ReadOnlyMemory<byte> buffer)
{
return CosmosElement.Monadic.CreateFromBuffer<CosmosNull>(buffer);
}
public static TryCatch<CosmosNull> Parse(string json)
{
return CosmosElement.Monadic.Parse<CosmosNull>(json);
}
}
}
#if INTERNAL
#pragma warning restore SA1600 // Elements should be documented
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
#endif
}