-module(datadog_query@filter). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/datadog_query/filter.gleam"). -export([tag/2, negated_tag/2, tag_in/2, tag_not_in/2]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. -file("src/datadog_query/filter.gleam", 15). ?DOC(" `name:value` — wildcards in `value` are preserved.\n"). -spec tag(binary(), binary()) -> binary(). tag(Name, Value) -> <<<>/binary, (datadog_query@quote:value(Value))/binary>>. -file("src/datadog_query/filter.gleam", 20). ?DOC(" `!name:value` — negated tag filter.\n"). -spec negated_tag(binary(), binary()) -> binary(). negated_tag(Name, Value) -> <<<<<<"!"/utf8, Name/binary>>/binary, ":"/utf8>>/binary, (datadog_query@quote:value(Value))/binary>>. -file("src/datadog_query/filter.gleam", 25). ?DOC(" `name IN (v1, v2, ...)` — empty list returns \"\".\n"). -spec tag_in(binary(), list(binary())) -> binary(). tag_in(Name, Values) -> case Values of [] -> <<""/utf8>>; _ -> <<<<<>/binary, (begin _pipe = Values, _pipe@1 = gleam@list:map( _pipe, fun datadog_query@quote:value/1 ), gleam@string:join(_pipe@1, <<", "/utf8>>) end)/binary>>/binary, ")"/utf8>> end. -file("src/datadog_query/filter.gleam", 37). ?DOC(" `name NOT IN (v1, v2, ...)` — empty list returns \"\".\n"). -spec tag_not_in(binary(), list(binary())) -> binary(). tag_not_in(Name, Values) -> case Values of [] -> <<""/utf8>>; _ -> <<<<<>/binary, (begin _pipe = Values, _pipe@1 = gleam@list:map( _pipe, fun datadog_query@quote:value/1 ), gleam@string:join(_pipe@1, <<", "/utf8>>) end)/binary>>/binary, ")"/utf8>> end.