class Triki
- Triki
- Reference
- Object
Overview
Standalone Crystal library for the selective rewriting (obfuscation/anonymization) of SQL dumps to protect user privacy.
Supports MySQL, PostgreSQL, and SQL Server dump formats.
Parse mysqldump outputs when using the -c option, which includes
column names in the INSERT statements.
Defined in:
triki.crtriki/base.cr
triki/config_applicator.cr
triki/config_parser.cr
triki/config_scaffold_generator.cr
triki/english_dictionary.cr
triki/faker.cr
triki/insert_statement_parser.cr
triki/mysql.cr
triki/postgres.cr
triki/sql_server.cr
triki/version.cr
Constant Summary
-
DEFAULT_INTEGER_RANGE =
0..1000 -
DEFAULT_STRING_LENGTH =
30 -
DIGIT_CHARS =
"1234567890" -
SENSIBLE_CHARS =
USERNAME_CHARS + "+-=[{]}/?|!@#$%^&*()`~" -
USERNAME_CHARS =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_" + DIGIT_CHARS -
VERSION =
"0.3.3"
Constructors
-
.new(configuration = ConfigHash.new)
Creates a new Triki obfuscator with the given configuration.
Instance Method Summary
- #config : ConfigHash
- #config=(config : ConfigHash)
- #database_type : Symbol
- #database_type=(database_type : Symbol)
- #fail_on_unspecified_columns=(fail_on_unspecified_columns : Bool)
- #fail_on_unspecified_columns? : Bool
- #globally_kept_columns : Array(String)
- #globally_kept_columns=(globally_kept_columns : Array(String))
-
#obfuscate(input_io : IO, output_io : IO) : Nil
Reads an input stream and writes an obfuscated output stream.
-
#scaffold(input_io : IO, output_io : IO) : Nil
Reads an input stream and writes a configuration scaffold to the output stream.
Constructor Detail
Creates a new Triki obfuscator with the given configuration.
The configuration is a hash mapping table names to either:
:truncate— remove all rows:keep— pass through unchanged- A
Hash(String, ConfigColumn)— per-column obfuscation rules
Instance Method Detail
Reads an input stream and writes an obfuscated output stream.
input_io — SQL dump to process (e.g. STDIN or File).
output_io — destination for the rewritten dump (e.g. STDOUT or File).
Reads an input stream and writes a configuration scaffold to the output stream.
The scaffold lists every table and column found in the dump with
placeholder :keep rules, making it easy to build an obfuscation config.