Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Npgsql.GeoJSON/Npgsql.GeoJSON.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<PackageTags>npgsql;postgresql;postgres;postgis;geojson;spatial;ado;ado.net;database;sql</PackageTags>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework Condition="'$(DeveloperBuild)' == 'True'">net8.0</TargetFramework>
<NoWarn>$(NoWarn);NPG9001</NoWarn> <!-- Converter-related APIs are experimental -->
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Npgsql.Json.NET/Npgsql.Json.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<TargetFramework>net6.0</TargetFramework>
<TargetFramework Condition="'$(DeveloperBuild)' == 'True'">net8.0</TargetFramework>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);NPG9001</NoWarn> <!-- Converter-related APIs are experimental -->
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<TargetFramework>net6.0</TargetFramework>
<TargetFramework Condition="'$(DeveloperBuild)' == 'True'">net8.0</TargetFramework>
<NoWarn>$(NoWarn);NU5104</NoWarn>
<NoWarn>$(NoWarn);NPG9001</NoWarn> <!-- Converter-related APIs are experimental -->
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Npgsql.NodaTime/Npgsql.NodaTime.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework Condition="'$(DeveloperBuild)' == 'True'">net8.0</TargetFramework>
<NoWarn>$(NoWarn);NPG9001</NoWarn> <!-- Converter-related APIs are experimental -->
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/Npgsql/Internal/BufferRequirements.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using System.Diagnostics.CodeAnalysis;

namespace Npgsql.Internal;

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public readonly struct BufferRequirements : IEquatable<BufferRequirements>
{
readonly Size _read;
Expand Down
2 changes: 2 additions & 0 deletions src/Npgsql/Internal/DataFormat.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace Npgsql.Internal;

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public enum DataFormat : byte
{
Binary,
Expand Down
1 change: 1 addition & 0 deletions src/Npgsql/Internal/DynamicTypeInfoResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Npgsql.Internal;

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
[RequiresDynamicCode("A dynamic type info resolver may need to construct a generic converter for a statically unknown type.")]
public abstract class DynamicTypeInfoResolver : IPgTypeInfoResolver
{
Expand Down
3 changes: 2 additions & 1 deletion src/Npgsql/Internal/HackyEnumTypeMapping.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using Npgsql.Internal;
Expand All @@ -8,10 +9,10 @@

namespace Npgsql.Internal;


/// <summary>
/// Hacky temporary measure used by EFCore.PG to extract user-configured enum mappings. Accessed via reflection only.
/// </summary>
[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public sealed class HackyEnumTypeMapping
{
public HackyEnumTypeMapping(Type enumClrType, string pgTypeName, INpgsqlNameTranslator nameTranslator)
Expand Down
6 changes: 4 additions & 2 deletions src/Npgsql/Internal/INpgsqlDatabaseInfoFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Npgsql.Util;

namespace Npgsql.Internal;
Expand All @@ -8,6 +9,7 @@ namespace Npgsql.Internal;
/// and the types it contains. When first connecting to a database, Npgsql will attempt to load information
/// about it via this factory.
/// </summary>
[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public interface INpgsqlDatabaseInfoFactory
{
/// <summary>
Expand All @@ -19,4 +21,4 @@ public interface INpgsqlDatabaseInfoFactory
/// database isn't of the correct type and isn't handled by this factory.
/// </returns>
Task<NpgsqlDatabaseInfo?> Load(NpgsqlConnector conn, NpgsqlTimeout timeout, bool async);
}
}
2 changes: 2 additions & 0 deletions src/Npgsql/Internal/IPgTypeInfoResolver.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using System.Diagnostics.CodeAnalysis;
using Npgsql.Internal.Postgres;

namespace Npgsql.Internal;

/// <summary>
/// An Npgsql resolver for type info. Used by Npgsql to read and write values to PostgreSQL.
/// </summary>
[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public interface IPgTypeInfoResolver
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/Npgsql/Internal/NpgsqlConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Net;
using System.Net.Security;
Expand All @@ -29,6 +30,7 @@ namespace Npgsql.Internal;
/// Represents a connection to a PostgreSQL backend. Unlike NpgsqlConnection objects, which are
/// exposed to users, connectors are internal to Npgsql and are recycled by the connection pool.
/// </summary>
[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public sealed partial class NpgsqlConnector
{
#region Fields and Properties
Expand Down
1 change: 1 addition & 0 deletions src/Npgsql/Internal/NpgsqlDatabaseInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace Npgsql.Internal;
/// Base class for implementations which provide information about PostgreSQL and PostgreSQL-like databases
/// (e.g. type definitions, capabilities...).
/// </summary>
[Experimental(NpgsqlDiagnostics.DatabaseInfoExperimental)]
public abstract class NpgsqlDatabaseInfo
{
#region Fields
Expand Down
2 changes: 2 additions & 0 deletions src/Npgsql/Internal/NpgsqlReadBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Buffers;
using System.Buffers.Binary;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Net.Sockets;
using System.Runtime.CompilerServices;
Expand All @@ -17,6 +18,7 @@ namespace Npgsql.Internal;
/// A buffer used by Npgsql to read data from the socket efficiently.
/// Provides methods which decode different values types and tracks the current position.
/// </summary>
[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
sealed partial class NpgsqlReadBuffer : IDisposable
{
#region Fields and Properties
Expand Down
1 change: 1 addition & 0 deletions src/Npgsql/Internal/PgBufferedConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace Npgsql.Internal;

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public abstract class PgBufferedConverter<T> : PgConverter<T>
{
protected PgBufferedConverter(bool customDbNullPredicate = false) : base(customDbNullPredicate) { }
Expand Down
1 change: 1 addition & 0 deletions src/Npgsql/Internal/PgConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Npgsql.Internal;

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public abstract class PgConverter
{
internal DbNullPredicate DbNullPredicateKind { get; }
Expand Down
2 changes: 2 additions & 0 deletions src/Npgsql/Internal/PgConverterResolver.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System;
using System.Diagnostics.CodeAnalysis;
using Npgsql.Internal.Postgres;

namespace Npgsql.Internal;

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public abstract class PgConverterResolver
{
private protected PgConverterResolver() { }
Expand Down
1 change: 1 addition & 0 deletions src/Npgsql/Internal/PgReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Npgsql.Internal;

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public class PgReader
{
// We don't want to add a ton of memory pressure for large strings.
Expand Down
2 changes: 2 additions & 0 deletions src/Npgsql/Internal/PgSerializerOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
Expand All @@ -8,6 +9,7 @@

namespace Npgsql.Internal;

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public sealed class PgSerializerOptions
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/Npgsql/Internal/PgStreamingConverter.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;

namespace Npgsql.Internal;

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public abstract class PgStreamingConverter<T> : PgConverter<T>
{
protected PgStreamingConverter(bool customDbNullPredicate = false) : base(customDbNullPredicate) { }
Expand Down
1 change: 1 addition & 0 deletions src/Npgsql/Internal/PgTypeInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Npgsql.Internal;

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public class PgTypeInfo
{
readonly bool _canBinaryConvert;
Expand Down
3 changes: 3 additions & 0 deletions src/Npgsql/Internal/PgTypeInfoResolverFactory.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using System.Diagnostics.CodeAnalysis;

namespace Npgsql.Internal;

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public abstract class PgTypeInfoResolverFactory
{
public abstract IPgTypeInfoResolver CreateResolver();
Expand Down
3 changes: 3 additions & 0 deletions src/Npgsql/Internal/PgWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Buffers;
using System.Buffers.Binary;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -92,6 +93,7 @@ public ValueTask FlushAsync(CancellationToken cancellationToken = default)
=> new(_buffer.Flush(async: true, cancellationToken));
}

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public sealed class PgWriter
{
readonly IBufferWriter<byte> _writer;
Expand Down Expand Up @@ -557,6 +559,7 @@ public override long Seek(long offset, SeekOrigin origin)
}

// No-op for now.
[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public struct NestedWriteScope : IDisposable
{
public void Dispose()
Expand Down
2 changes: 2 additions & 0 deletions src/Npgsql/Internal/Postgres/DataTypeName.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace Npgsql.Internal.Postgres;

/// <summary>
/// Represents the fully-qualified name of a PostgreSQL type.
/// </summary>
[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
[DebuggerDisplay("{DisplayName,nq}")]
public readonly struct DataTypeName : IEquatable<DataTypeName>
{
Expand Down
3 changes: 3 additions & 0 deletions src/Npgsql/Internal/Postgres/Field.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System.Diagnostics.CodeAnalysis;

namespace Npgsql.Internal.Postgres;

/// Base field type shared between tables and composites.
[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public readonly struct Field
{
public Field(string name, PgTypeId pgTypeId, int typeModifier)
Expand Down
2 changes: 2 additions & 0 deletions src/Npgsql/Internal/Postgres/Oid.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using System.Diagnostics.CodeAnalysis;

namespace Npgsql.Internal.Postgres;

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public readonly struct Oid: IEquatable<Oid>
{
public Oid(uint value) => Value = value;
Expand Down
1 change: 1 addition & 0 deletions src/Npgsql/Internal/Postgres/PgTypeId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace Npgsql.Internal.Postgres;
/// <summary>
/// A discriminated union of <see cref="Oid" /> and <see cref="DataTypeName" />.
/// </summary>
[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public readonly struct PgTypeId: IEquatable<PgTypeId>
{
readonly DataTypeName _dataTypeName;
Expand Down
3 changes: 3 additions & 0 deletions src/Npgsql/Internal/Size.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace Npgsql.Internal;

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public enum SizeKind
{
Unknown = 0,
Exact,
UpperBound
}

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public readonly struct Size : IEquatable<Size>
{
Expand Down
6 changes: 6 additions & 0 deletions src/Npgsql/Internal/TypeInfoMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ namespace Npgsql.Internal;
/// <param name="resolvedDataTypeName">
/// Signals whether a resolver based TypeInfo can keep its PgTypeId undecided or whether it should follow mapping.DataTypeName.
/// </param>
[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public delegate PgTypeInfo TypeInfoFactory(PgSerializerOptions options, TypeInfoMapping mapping, bool resolvedDataTypeName);

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public enum MatchRequirement
{
/// Match when the clr type and datatype name both match.
Expand All @@ -33,6 +35,7 @@ public enum MatchRequirement
}

/// A factory for well-known PgConverters.
[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public static class PgConverterFactory
{
public static PgConverter<T[]> CreateArrayMultirangeConverter<T>(PgConverter<T> rangeConverter, PgSerializerOptions options) where T : notnull
Expand All @@ -55,6 +58,7 @@ public static PgConverter<TBase> CreatePolymorphicArrayConverter<TBase>(Func<PgC
}

[DebuggerDisplay("{DebuggerDisplay,nq}")]
[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public readonly struct TypeInfoMapping
{
public TypeInfoMapping(Type type, string dataTypeName, TypeInfoFactory factory)
Expand Down Expand Up @@ -99,6 +103,7 @@ string DebuggerDisplay
}
}

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public sealed class TypeInfoMappingCollection
{
readonly TypeInfoMappingCollection? _baseCollection;
Expand Down Expand Up @@ -731,6 +736,7 @@ static void ThrowBoxingNotSupported(bool resolver)
=> throw new InvalidOperationException($"Boxing converters are not supported, manually construct a mapping over a casting converter{(resolver ? " resolver" : "")} instead.");
}

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public static class TypeInfoMappingHelpers
{
internal static bool TryResolveFullyQualifiedName(PgSerializerOptions options, string dataTypeName, out DataTypeName fqDataTypeName)
Expand Down
3 changes: 3 additions & 0 deletions src/Npgsql/Internal/ValueMetadata.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using System.Diagnostics.CodeAnalysis;

namespace Npgsql.Internal;

[Experimental(NpgsqlDiagnostics.ConvertersExperimental)]
public readonly struct ValueMetadata
{
public required DataFormat Format { get; init; }
Expand Down
2 changes: 2 additions & 0 deletions src/Npgsql/Npgsql.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition="'$(DeveloperBuild)' == 'True'">net8.0</TargetFrameworks>
<NoWarn>$(NoWarn);CA2017</NoWarn>
<NoWarn>$(NoWarn);NPG9001</NoWarn> <!-- Converter-related APIs are experimental -->
<NoWarn>$(NoWarn);NPG9002</NoWarn> <!-- DatabaseInfo-related APIs are experimental -->
</PropertyGroup>

<ItemGroup>
Expand Down
7 changes: 7 additions & 0 deletions src/Npgsql/NpgsqlDiagnostics.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Npgsql;

static class NpgsqlDiagnostics
{
public const string ConvertersExperimental = "NPG9001";
public const string DatabaseInfoExperimental = "NPG9002";
}
Loading