-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathIRoutineSourceParameterFormatter.cs
More file actions
66 lines (58 loc) · 3.23 KB
/
Copy pathIRoutineSourceParameterFormatter.cs
File metadata and controls
66 lines (58 loc) · 3.23 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
using Npgsql;
namespace NpgsqlRest
{
public interface IRoutineSourceParameterFormatter
{
/// <summary>
/// Return true to call FormatCommand
/// Return false to call AppendCommandParameter or AppendEmpty (when no parameters are present).
/// </summary>
bool IsFormattable { get; }
/// <summary>
/// Return true to call format methods with HttpContext reference.
/// Return false to call format methods without HttpContext reference.
/// </summary>
bool RefContext { get => false; }
/// <summary>
/// Appends result to the command expression string.
/// </summary>
/// <param name="parameter">NpgsqlRestParameter extended parameter with actual name and type descriptor</param>
/// <param name="index">index of the current parameter</param>
/// <returns>string to append to expression or null to skip (404 if endpoint is not handled in the next handler)</returns>
string? AppendCommandParameter(NpgsqlRestParameter parameter, int index) => null;
/// <summary>
/// Formats the command expression string.
/// </summary>
/// <param name="routine">Current routine data</param>
/// <param name="parameters">Extended parameters list.</param>
/// <returns>expression string or null to skip (404 if endpoint is not handled in the next handler)</returns>
string? FormatCommand(Routine routine, NpgsqlParameterCollection parameters) => null;
/// <summary>
/// Called when there are no parameters to append.
/// </summary>
/// <returns>string to append to expression or null to skip (404 if endpoint is not handled in the next handler)</returns>
string? AppendEmpty() => null;
/// <summary>
/// Appends result to the command expression string.
/// </summary>
/// <param name="parameter">NpgsqlRestParameter extended parameter with actual name and type descriptor</param>
/// <param name="index">index of the current parameter</param>
/// <param name="context">HTTP context reference</param>
/// <returns>string to append to expression or null to skip (404 if endpoint is not handled in the next handler)</returns>
string? AppendCommandParameter(NpgsqlRestParameter parameter, int index, HttpContext context) => null;
/// <summary>
/// Formats the command expression string.
/// </summary>
/// <param name="routine">Current routine data</param>
/// <param name="parameters">Extended parameters list.</param>
/// <param name="context">HTTP context reference</param>
/// <returns>expression string or null to skip (404 if endpoint is not handled in the next handler)</returns>
string? FormatCommand(Routine routine, NpgsqlParameterCollection parameters, HttpContext context) => null;
/// <summary>
/// Called when there are no parameters to append.
/// </summary>
/// <param name="context">HTTP context reference</param>
/// <returns>string to append to expression or null to skip (404 if endpoint is not handled in the next handler)</returns>
string? AppendEmpty(HttpContext context) => null;
}
}