zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

void_text.ex (538B)


      1 defmodule Postgrex.Extensions.VoidText do
      2   @moduledoc false
      3   @behaviour Postgrex.Extension
      4   import Postgrex.BinaryUtils, warn: false
      5 
      6   def init(_), do: nil
      7 
      8   def matching(_), do: [output: "void_out"]
      9 
     10   def format(_), do: :text
     11 
     12   def encode(_) do
     13     quote location: :keep do
     14       :void ->
     15         <<0::int32()>>
     16 
     17       other ->
     18         raise DBConnection.EncodeError, Postgrex.Utils.encode_msg(other, "the atom :void")
     19     end
     20   end
     21 
     22   def decode(_) do
     23     quote location: :keep do
     24       <<0::int32()>> -> :void
     25     end
     26   end
     27 end