更新tools注释

This commit is contained in:
111yuzhiying 2023-09-22 11:58:35 +08:00
parent 9c287ac5ad
commit 6b9fcdb2c7
1 changed files with 35 additions and 23 deletions

View File

@ -240,26 +240,38 @@ Datum citext_ge(PG_FUNCTION_ARGS)
* ===================
*/
PG_FUNCTION_INFO_V1(citext_smaller);
Datum citext_smaller(PG_FUNCTION_ARGS)
{
text* left = PG_GETARG_TEXT_PP(0);
text* right = PG_GETARG_TEXT_PP(1);
text* result = NULL;
result = (citextcmp(left, right, PG_GET_COLLATION()) < 0) ? left : right;
PG_RETURN_TEXT_P(result);
}
PG_FUNCTION_INFO_V1(citext_larger);
Datum citext_larger(PG_FUNCTION_ARGS)
{
text* left = PG_GETARG_TEXT_PP(0);
text* right = PG_GETARG_TEXT_PP(1);
text* result = NULL;
result = (citextcmp(left, right, PG_GET_COLLATION()) > 0) ? left : right;
PG_RETURN_TEXT_P(result);
}
// Declare a function named citext_smaller, which is an internal function of PostgreSQL, used to compare whether the first citext value is smaller than the second.
PG_FUNCTION_INFO_V1(citext_smaller);
// Implement the citext_smaller function. This function takes two parameters (two text* pointers) and returns a text* value.
Datum citext_smaller(PG_FUNCTION_ARGS)
{
// Get the first and second text* pointers from the function parameters and assign them to left and right respectively.
text* left = PG_GETARG_TEXT_PP(0);
text* right = PG_GETARG_TEXT_PP(1);
// Initialize a text* variable result, which will store the result of the comparison.
text* result = NULL;
// Use the citextcmp function to compare left and right. If left is smaller than right, assign left to result; otherwise, assign right to result.
result = (citextcmp(left, right, PG_GET_COLLATION()) < 0) ? left : right;
// Return the result of the comparison.
PG_RETURN_TEXT_P(result);
}
// Declare a function named citext_larger, which is an internal function of PostgreSQL, used to compare whether the first citext value is larger than the second.
PG_FUNCTION_INFO_V1(citext_larger);
// Implement the citext_larger function. This function takes two parameters (two text* pointers) and returns a text* value.
Datum citext_larger(PG_FUNCTION_ARGS)
{
// Get the first and second text* pointers from the function parameters and assign them to left and right respectively.
text* left = PG_GETARG_TEXT_PP(0);
text* right = PG_GETARG_TEXT_PP(1);
// Initialize a text* variable result, which will store the result of the comparison.
text* result = NULL;
// Use the citextcmp function to compare left and right. If left is larger than right, assign left to result; otherwise, assign right to result.
result = (citextcmp(left, right, PG_GET_COLLATION()) > 0) ? left : right;
// Return the result of the comparison.
PG_RETURN_TEXT_P(result);
}