struct Triki::Postgres

Included Modules

Defined in:

triki/postgres.cr

Instance Method Summary

Instance methods inherited from module Triki::ConfigScaffoldGenerator

config_table_close(table_name) config_table_close, config_table_open(table_name) config_table_open, emit_scaffold(table_name, existing_config, extra_columns, columns_to_scaffold, output_io) emit_scaffold, formatted_line(column, definition, comment = nil) formatted_line, generate_config(obfuscator, config, input_io, output_io) generate_config

Instance methods inherited from struct Triki::Base

initialize initialize, parse(obfuscator, config, input_io, output_io) parse

Constructor methods inherited from struct Triki::Base

new new

Instance Method Detail

def make_insert_statement(table_name, column_names, values, ignore = nil) #

[View source]
def make_valid_value_string(value) #

[View source]
def parse(obfuscator, config, input_io, output_io) #

Postgres uses COPY statements instead of INSERT and look like:

COPY some_table (a, b, c, d) FROM stdin; 1 2 3 4 5 6 7 8 .

This requires the parse methods to persist data (table name and column names) across multiple lines.


[View source]
def parse_copy_statement(line) #

[View source]
def parse_insert_statement(line) #

[View source]
def rows_to_be_inserted(line) : Array(Array(String | Nil)) #

Copy statements contain the column values tab separated like so: blah blah blah blah which we want to turn into: [['blah','blah','blah','blah']]

We wrap it in an array to keep it consistent with MySql bulk obfuscation (multiple rows per insert statement)


[View source]
def table_data(line) #

[View source]