Module kflow_postgres

This module inserts a batch of Erlang maps as rows in a Postgres table.

Copyright © 2018-2020 Klarna Bank AB (publ)

Description

This module inserts a batch of Erlang maps as rows in a Postgres table.

Input message format

   [ #{field1 => val1, field2 => val2}
   , #{field1 => val3, field2 => val4}
   ]

Output message format

Input message is returned as is.

Configuration

Configuration is a term of config/0 type. It's a map with the following mandatory fields:

The following options are optional:

Example usage

   {map, kflow_postgres, #{ database => #{ host     => "localhost"
                                         , user     => "kflow"
                                         , password => "123"
                                         , database => "postgres"
                                         , port     => 5432
                                         }
                          , table  => "foo_table"
                          , fields => [foo, bar, baz]
                          , keys   => [foo]
                          }}

Data Types

config()

config() = #{database := epgsql:connect_opts(), init_count => non_neg_integer(), fields := [field()], keys => [field()], table := list() | binary(), field_mappings => field_mappings()}

field()

field() = atom() | list() | binary()

field_mappings()

field_mappings() = #{field() => field()}


Generated by EDoc