-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathRoutine.cs
More file actions
142 lines (119 loc) · 4.49 KB
/
Copy pathRoutine.cs
File metadata and controls
142 lines (119 loc) · 4.49 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
namespace NpgsqlRest;
public readonly struct Routine(
string name,
string expression,
RoutineType type = RoutineType.Other,
string schema = "",
string? comment = null,
bool isStrict = false,
CrudType crudType = CrudType.Select,
bool returnsRecordType = false,
bool returnsSet = false,
int columnCount = 1,
string[]? columnNames = null,
TypeDescriptor[]? columnsTypeDescriptor = null,
bool returnsUnnamedSet = true,
bool isVoid = true,
int paramCount = 0,
string[]? paramNames = null,
TypeDescriptor[]? paramTypeDescriptor = null,
string? fullDefinition = null,
string? simpleDefinition = null,
string? formatUrlPattern = null,
string[]? tags = null,
Func<RoutineEndpoint?, RoutineEndpoint?>? endpointHandler = null,
object? metadata = null)
{
/// <summary>
/// Routine type: Function, Procedure, Table, View, or other.
/// </summary>
public RoutineType Type { get; init; } = type;
/// <summary>
/// Schema name (parsed by quote_ident).
/// </summary>
public string Schema { get; init; } = schema;
/// <summary>
/// PostgreSQL object name (parsed by quote_ident).
/// </summary>
public string Name { get; init; } = name;
/// <summary>
/// PostgreSQL object comment.
/// </summary>
public string? Comment { get; init; } = comment;
/// <summary>
/// Strict or non-strict function. Strict functions will return NULL if any parameter is NULL.
/// </summary>
public bool IsStrict { get; init; } = isStrict;
/// <summary>
/// The type of CRUD operation associated with the routine (Select, Insert, Update or Delete).
/// </summary>
public CrudType CrudType { get; init; } = crudType;
/// <summary>
/// Indicates whether the routine returns a PostgreSQL record type.
/// </summary>
public bool ReturnsRecordType { get; init; } = returnsRecordType;
/// <summary>
/// Indicates whether the routine returns a set of records or single record.
/// </summary>
public bool ReturnsSet { get; init; } = returnsSet;
/// <summary>
/// The number of columns returned.
/// </summary>
public int ColumnCount { get; init; } = columnCount;
/// <summary>
/// The names of the returned columns.
/// </summary>
public string[] ColumnNames { get; init; } = columnNames ?? [];
/// <summary>
/// The type descriptors for the returned columns.
/// </summary>
public TypeDescriptor[] ColumnsTypeDescriptor { get; init; } = columnsTypeDescriptor ?? [];
/// <summary>
/// Indicates whether the routine returns an unnamed set.
/// </summary>
public bool ReturnsUnnamedSet { get; init; } = returnsUnnamedSet;
/// <summary>
/// Indicates whether the routine returns void.
/// </summary>
public bool IsVoid { get; init; } = isVoid;
/// <summary>
/// The number of parameters.
/// </summary>
public int ParamCount { get; init; } = paramCount;
/// <summary>
/// The names of the parameters.
/// </summary>
public string[] ParamNames { get; init; } = paramNames ?? [];
/// <summary>
/// The type descriptors of the parameter types.
/// </summary>
public TypeDescriptor[] ParamTypeDescriptor { get; init; } = paramTypeDescriptor ?? [];
/// <summary>
/// The expression associated with the routine.
/// </summary>
public string Expression { get; init; } = expression;
/// <summary>
/// The full definition of the routine. (Used for code-gen comments)
/// </summary>
public string FullDefinition { get; init; } = fullDefinition ?? expression;
/// <summary>
/// The simple definition of the routine. (Used for code-gen comments)
/// </summary>
public string SimpleDefinition { get; init; } = simpleDefinition ?? expression;
/// <summary>
/// The format URL pattern for the routine. If used (not null), placeholder {0} is used to replace the default URL.
/// </summary>
public string? FormatUrlPattern { get; init; } = formatUrlPattern;
/// <summary>
/// The tags associated with the routine.
/// </summary>
public string[]? Tags { get; init; } = tags;
/// <summary>
/// The endpoint handler for the routine.
/// </summary>
public Func<RoutineEndpoint?, RoutineEndpoint?>? EndpointHandler { get; init; } = endpointHandler;
/// <summary>
/// The meta data associated with the routine.
/// </summary>
public object? Metadata { get; init; } = metadata;
}