Documentation

gomask connectors

Manage database connectors

gomask connectors

Manage database connectors for data generation and masking.

Synopsis

gomask connectors <subcommand> [OPTIONS]

Subcommands

CommandDescription
listList all database connectors
createCreate a new database connector
showDisplay connector details
testTest connector connection
deleteDelete a connector

gomask connectors list

List all database connectors available to your team.

Synopsis

gomask connectors list

Examples

gomask connectors list

Output:

ID   Name           Type        Host                  Database   Status
───  ─────────────  ──────────  ────────────────────  ─────────  ──────
1    prod-postgres  postgresql  db.example.com        myapp      ✓ ok
2    staging-mysql  mysql       staging.example.com   staging    ✓ ok
3    dev-local      postgresql  localhost             devdb      ✗ error

Total connectors: 3

gomask connectors create

Create a new database connector.

Synopsis

gomask connectors create [OPTIONS]

Options

OptionTypeDefaultDescription
--name TEXTstring(required)Unique connector name
--type TYPEstring(required)Database type (see below)
--host TEXTstring(required)Database host address
--port INTEGERintegerautoDatabase port (defaults based on type)
--database TEXTstring(required)Database name
--username TEXTstring(required)Database username
--password TEXTstring(prompted)Database password (prompted securely if not provided)
--password-env TEXTstringnoneEnvironment variable containing password
--ssl-mode MODEstringpreferSSL mode: require, prefer, disable
--skip-testflagfalseSkip connection test after creation

Supported Database Types

TypeDefault PortDescription
postgresql5432PostgreSQL 10+
mysql3306MySQL 5.7+ / MariaDB 10.3+
oracle1521Oracle Database 12c+
sqlserver1433Microsoft SQL Server 2016+
mongodb27017MongoDB 4.0+

Examples

# Interactive creation (prompts for password)
gomask connectors create \
  --name prod-postgres \
  --type postgresql \
  --host db.example.com \
  --database myapp \
  --username appuser

Output:

Enter database password: ********
Testing connection...
✓ Connection successful

Connector created:
  ID: 1
  Name: prod-postgres
  Type: postgresql
  Host: db.example.com:5432
  Database: myapp
# With password from environment variable
gomask connectors create \
  --name staging-db \
  --type mysql \
  --host staging.example.com \
  --database staging \
  --username deploy \
  --password-env DB_PASSWORD

# With SSL required
gomask connectors create \
  --name secure-db \
  --type postgresql \
  --host secure.example.com \
  --database proddb \
  --username admin \
  --ssl-mode require

# Skip connection test
gomask connectors create \
  --name future-db \
  --type postgresql \
  --host future.example.com \
  --database newdb \
  --username admin \
  --skip-test

gomask connectors show

Display detailed information about a connector.

Synopsis

gomask connectors show CONNECTOR_ID_OR_NAME

Arguments

ArgumentDescription
CONNECTOR_ID_OR_NAMEThe connector's numeric ID or name

Examples

gomask connectors show prod-postgres

Output:

Connector Details
─────────────────
ID:        1
Name:      prod-postgres
Type:      postgresql
Host:      db.example.com
Port:      5432
Database:  myapp
Username:  appuser
SSL Mode:  prefer
Status:    ✓ connected
Created:   2024-01-15 10:30:00
Updated:   2024-01-20 14:45:00

Usage:
  Routines using this connector: 5
  Last execution: 2024-01-25 08:00:00

gomask connectors test

Test a connector's database connection.

Synopsis

gomask connectors test CONNECTOR_ID_OR_NAME

Arguments

ArgumentDescription
CONNECTOR_ID_OR_NAMEThe connector's numeric ID or name

Examples

gomask connectors test prod-postgres

Output (success):

Testing connection to 'prod-postgres'...
✓ Connection successful

Server: PostgreSQL 15.2
Response time: 45ms

Output (failure):

Testing connection to 'prod-postgres'...
✗ Connection failed

Error: Connection refused
  Host: db.example.com:5432

Possible causes:
  - Database server is not running
  - Firewall blocking the connection
  - Incorrect host or port

gomask connectors delete

Delete a database connector.

Synopsis

gomask connectors delete CONNECTOR_ID_OR_NAME [OPTIONS]

Arguments

ArgumentDescription
CONNECTOR_ID_OR_NAMEThe connector's numeric ID or name

Options

OptionTypeDefaultDescription
--forceflagfalseDelete without confirmation prompt

Examples

# With confirmation
gomask connectors delete old-connector

Output:

This will delete connector 'old-connector'.
This action cannot be undone.

Are you sure? [y/N]: y
✓ Connector deleted
# Force delete (no confirmation)
gomask connectors delete old-connector --force

Restrictions

You cannot delete a connector that is:

  • Referenced by active routines
  • Currently in use by a running execution
Error: Cannot delete connector 'prod-postgres'
  - Used by 3 routines
  - Remove connector references first

Connection String Examples

PostgreSQL

gomask connectors create \
  --name postgres-prod \
  --type postgresql \
  --host db.example.com \
  --port 5432 \
  --database myapp \
  --username appuser \
  --ssl-mode require

MySQL

gomask connectors create \
  --name mysql-staging \
  --type mysql \
  --host mysql.example.com \
  --port 3306 \
  --database staging \
  --username deploy

Oracle

gomask connectors create \
  --name oracle-prod \
  --type oracle \
  --host oracle.example.com \
  --port 1521 \
  --database ORCL \
  --username system

SQL Server

gomask connectors create \
  --name sqlserver-prod \
  --type sqlserver \
  --host mssql.example.com \
  --port 1433 \
  --database ProductionDB \
  --username sa

MongoDB

gomask connectors create \
  --name mongo-analytics \
  --type mongodb \
  --host mongo.example.com \
  --port 27017 \
  --database analytics \
  --username admin

Exit Codes

CodeDescription
0Command completed successfully
1Error (connection failed, not found, permission denied, etc.)

See Also