supabase+GraphiQL의 String 검색에서 like 사용 가능
5814 단어 GraphQLPostgreSQLsupabasetech
supabase가 그렇게 되면 GraphiQL Filter에서 like를 사용할 수 없어요.
RestAPI에는 있지만 GraphiQL에는 like 연산자가 없습니다.그럼 안돼.
기능 추가
없는 건 어쩔 수 없으니까 하는 거야.
다음 SQL을 실행하면 GraphiQL 모드에 like가 나타납니다.
create or replace function graphql.text_to_comparison_op(text)
returns graphql.comparison_op
language sql
immutable
as
$$
select
case $1
when 'eq' then '='
when 'lt' then '<'
when 'lte' then '<='
when 'neq' then '<>'
when 'gte' then '>='
when 'gt' then '>'
when 'like' then 'like'
else graphql.exception('Invalid comaprison operator')
end::graphql.comparison_op
$$;
insert into graphql._field(parent_type_id, type_id, constant_name, is_not_null, is_array, description)
select
gt.id as parent_type_id,
gt.graphql_type_id type_id,
ops.constant_name as constant_name,
false,
false,
null::text as description
from
graphql.type gt
join (
values
('like')
) ops(constant_name)
on true
where
gt.meta_kind = 'FilterType'
and gt.graphql_type_id = graphql.type_id('String');
alter type graphql.comparison_op add value 'like';
ApolloStudio를 통한 모드 확인
다음은 정확하게 추가한 것이다
총결산
supabase에서 GraphiQL을 사용하는 사람은 드문 것 같은데, 어려운 친구를 도와주면 좋겠어요.
Reference
이 문제에 관하여(supabase+GraphiQL의 String 검색에서 like 사용 가능), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/sora_kumo/articles/718f9af36891c6텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)