tid.ex (553B)
1 defmodule Postgrex.Extensions.TID do 2 @moduledoc false 3 import Postgrex.BinaryUtils, warn: false 4 use Postgrex.BinaryExtension, send: "tidsend" 5 6 def encode(_) do 7 quote location: :keep do 8 {block, tuple} -> 9 <<6::int32(), block::uint32(), tuple::uint16()>> 10 11 other -> 12 raise DBConnection.EncodeError, Postgrex.Utils.encode_msg(other, "a tuple of 2 integers") 13 end 14 end 15 16 def decode(_) do 17 quote location: :keep do 18 <<6::int32(), block::uint32(), tuple::uint16()>> -> 19 {block, tuple} 20 end 21 end 22 end