postgleam/copy

COPY protocol support for bulk data transfer.

Values

pub fn copy_in(
  state: connection.ConnectionState,
  sql: String,
  data: List(BitArray),
  timeout: Int,
) -> Result(#(String, connection.ConnectionState), error.Error)

COPY rows into a table. sql must be a COPY ... FROM STDIN statement and data the rows in the COPY format (text format: tab-separated, each row ending with \n). Returns the command tag, e.g. "COPY 1000".

pub fn copy_out(
  state: connection.ConnectionState,
  sql: String,
  timeout: Int,
) -> Result(
  #(List(BitArray), connection.ConnectionState),
  error.Error,
)

COPY rows out of a table. sql must be a COPY ... TO STDOUT statement. Returns the raw data chunks (one per row in text format).

✨ Search Document