Current section
Files
Jump to
Current section
Files
src/postgleam@codec@bytea.erl
-module(postgleam@codec@bytea).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/postgleam/codec/bytea.gleam").
-export([encode/1, decode/1, matcher/0]).
-file("src/postgleam/codec/bytea.gleam", 31).
-spec encode(postgleam@value:value()) -> {ok, bitstring()} | {error, binary()}.
encode(Val) ->
case Val of
{bytea, Data} ->
{ok, Data};
_ ->
{error, <<"bytea codec: expected Bytea value"/utf8>>}
end.
-file("src/postgleam/codec/bytea.gleam", 38).
-spec decode(bitstring()) -> {ok, postgleam@value:value()} | {error, binary()}.
decode(Data) ->
{ok, {bytea, Data}}.
-file("src/postgleam/codec/bytea.gleam", 21).
-spec build(integer()) -> postgleam@codec:codec().
build(Type_oid) ->
{codec, <<"bytea"/utf8>>, Type_oid, binary, fun encode/1, fun decode/1}.
-file("src/postgleam/codec/bytea.gleam", 11).
-spec matcher() -> postgleam@codec:codec_matcher().
matcher() ->
{codec_matcher, <<"bytea"/utf8>>, [17], none, binary, fun build/1}.