forked from npgsql/npgsql
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathOid.cs
More file actions
20 lines (17 loc) · 841 Bytes
/
Oid.cs
File metadata and controls
20 lines (17 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using System;
using System.Diagnostics.CodeAnalysis;
namespace Npgsql.Internal.Postgres;
[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public readonly struct Oid(uint value) : IEquatable<Oid>
{
public static explicit operator uint(Oid oid) => oid.Value;
public static implicit operator Oid(uint oid) => new(oid);
public uint Value { get; init; } = value;
public static Oid Unspecified => new(0);
public override string ToString() => Value.ToString();
public bool Equals(Oid other) => Value == other.Value;
public override bool Equals(object? obj) => obj is Oid other && Equals(other);
public override int GetHashCode() => (int)Value;
public static bool operator ==(Oid left, Oid right) => left.Equals(right);
public static bool operator !=(Oid left, Oid right) => !left.Equals(right);
}