-
Notifications
You must be signed in to change notification settings - Fork 874
Expand file tree
/
Copy pathPostgresArrayType.cs
More file actions
46 lines (40 loc) · 1.52 KB
/
PostgresArrayType.cs
File metadata and controls
46 lines (40 loc) · 1.52 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
using Npgsql.Internal.Postgres;
namespace Npgsql.PostgresTypes;
/// <summary>
/// Represents a PostgreSQL array data type, which can hold several multiple values in a single column.
/// </summary>
/// <remarks>
/// See https://www.postgresql.org/docs/current/static/arrays.html.
/// </remarks>
public class PostgresArrayType : PostgresType
{
/// <summary>
/// The PostgreSQL data type of the element contained within this array.
/// </summary>
public PostgresType Element { get; }
/// <summary>
/// Constructs a representation of a PostgreSQL array data type.
/// </summary>
protected internal PostgresArrayType(string ns, string name, uint oid, PostgresType elementPostgresType)
: base(ns, name, oid)
{
Element = elementPostgresType;
Element.Array = this;
}
/// <summary>
/// Constructs a representation of a PostgreSQL array data type.
/// </summary>
internal PostgresArrayType(DataTypeName dataTypeName, Oid oid, PostgresType elementPostgresType)
: base(dataTypeName, oid)
{
Element = elementPostgresType;
Element.Array = this;
}
// PostgreSQL array types have an underscore-prefixed name (_text), but we
// want to return the public text[] instead
/// <inheritdoc/>
internal override string GetPartialNameWithFacets(int typeModifier)
=> Element.GetPartialNameWithFacets(typeModifier) + "[]";
internal override PostgresFacets GetFacets(int typeModifier)
=> Element.GetFacets(typeModifier);
}