Current section
Files
Jump to
Current section
Files
lib/pg_secret/ore_block_32_8.ex
defmodule PGSecret.OREBlock_32_8 do
@moduledoc false
use Postgrex.BinaryExtension,
type: "ore_block_32_8",
send: "ore_block_send_32_8",
receive: "ore_block_recv_32_8",
input: "ore_block_in_32_8",
output: "ore_block_out_32_8",
warn: false
@impl true
def encode(_) do
quote location: :keep do
bin = <<_left::80*8, _right::144*8>> ->
[<<byte_size(bin) :: signed-size(32)>> | bin]
other ->
raise DBConnection.EncodeError, Postgrex.Utils.encode_msg(other, "valid ORE block")
end
end
@impl true
def decode(_) do
quote location: :keep do
<<len::signed-size(32), bin::binary-size(len)>> ->
bin
end
end
end