[jOOQ/jOOQ#16754] Add JSON function support in BigQuery

Support:

- JSON_OBJECT
- JSON_ARRAY
This commit is contained in:
Lukas Eder 2024-06-04 09:50:05 +02:00
parent 579d516105
commit ee9f6ad768
4 changed files with 37 additions and 3 deletions

View File

@ -199,6 +199,17 @@ implements

View File

@ -153,9 +153,9 @@ implements
case POSTGRES:
case YUGABYTEDB:
if (onNull == JSONOnNull.ABSENT_ON_NULL)
ctx.visit(unquotedName(getDataType().getType() == JSONB.class ? "jsonb_strip_nulls" : "json_strip_nulls")).sql('(');
ctx.visit(getDataType().getType() == JSONB.class ? N_JSONB_STRIP_NULLS : N_JSON_STRIP_NULLS).sql('(');
ctx.visit(unquotedName(getDataType().getType() == JSONB.class ? "jsonb_build_object" : "json_build_object")).sql('(').visit(QueryPartCollectionView.wrap(entries)).sql(')');
ctx.visit(getDataType().getType() == JSONB.class ? N_JSONB_BUILD_OBJECT : N_JSON_BUILD_OBJECT).sql('(').visit(QueryPartCollectionView.wrap(entries)).sql(')');
if (onNull == JSONOnNull.ABSENT_ON_NULL)
ctx.sql(')');
@ -194,6 +194,17 @@ implements

View File

@ -37,6 +37,7 @@
*/
package org.jooq.impl;
// ...
// ...
// ...
import static org.jooq.SQLDialect.H2;
@ -58,7 +59,14 @@ import org.jooq.impl.QOM.UTransient;
/**
* @author Lukas Eder
*/
final class JSONReturning extends AbstractQueryPart implements SimpleQueryPart, UTransient {
final class JSONReturning
extends
AbstractQueryPart
implements
SimpleQueryPart,
UTransient
{
static final Set<SQLDialect> NO_SUPPORT_RETURNING = SQLDialect.supportedBy(H2, MARIADB, MYSQL, POSTGRES, SQLITE, YUGABYTEDB);
final DataType<?> type;

View File

@ -160,14 +160,17 @@ final class Names {
static final Name N_JSON = systemName("json");
static final Name N_JSONB_AGG = systemName("jsonb_agg");
static final Name N_JSONB_BUILD_ARRAY = systemName("jsonb_build_array");
static final Name N_JSONB_BUILD_OBJECT = systemName("jsonb_build_object");
static final Name N_JSONB_OBJECT_AGG = systemName("jsonb_object_agg");
static final Name N_JSONB_PATH_EXISTS = systemName("jsonb_path_exists");
static final Name N_JSONB_PATH_QUERY_ARRAY = systemName("jsonb_path_query_array");
static final Name N_JSONB_PATH_QUERY_FIRST = systemName("jsonb_path_query_first");
static final Name N_JSONB_STRIP_NULLS = systemName("jsonb_strip_nulls");
static final Name N_JSONPATH = systemName("jsonpath");
static final Name N_JSON_AGG = systemName("json_agg");
static final Name N_JSON_ARRAYAGG = systemName("json_arrayagg");
static final Name N_JSON_BUILD_ARRAY = systemName("json_build_array");
static final Name N_JSON_BUILD_OBJECT = systemName("json_build_object");
static final Name N_JSON_CONTAINS_PATH = systemName("json_contains_path");
static final Name N_JSON_GROUP_ARRAY = systemName("json_group_array");
static final Name N_JSON_GROUP_OBJECT = systemName("json_group_object");
@ -178,6 +181,7 @@ final class Names {
static final Name N_JSON_PARSE = systemName("json_parse");
static final Name N_JSON_QUERY = systemName("json_query");
static final Name N_JSON_QUOTE = systemName("json_quote");
static final Name N_JSON_STRIP_NULLS = systemName("json_strip_nulls");
static final Name N_JSON_TABLE = systemName("json_table");
static final Name N_JSON_TREE = systemName("json_tree");
static final Name N_JSON_TYPE = systemName("json_type");