/
dev-npgsql
/
npgsql
Обзор
Документация
Войти
/
dev-npgsql
/
npgsql
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
test-logs
src/Npgsql/Internal/DataFormat.cs
31 строка
803 B
Shay Rojansky
Add [Experimental] to converter-related APIs (#5668)
12 апр 2024, 21:10
Не верифицирован
12 апр 2024, 21:10
c86e5ef
Код
Авторство
О чём код?
using System; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; namespace Npgsql.Internal; [Experimental(NpgsqlDiagnostics.ConvertersExperimental)] public enum DataFormat : byte { Binary, Text } static class DataFormatUtils { public static DataFormat Create(short formatCode) => formatCode switch { 0 => DataFormat.Text, 1 => DataFormat.Binary, _ => throw new ArgumentOutOfRangeException(nameof(formatCode), formatCode, "Unknown postgres format code, please file a bug,") }; public static short ToFormatCode(this DataFormat dataFormat) => dataFormat switch { DataFormat.Text => 0, DataFormat.Binary => 1, _ => throw new UnreachableException() }; }