gomask connectors
Manage database connectors
gomask connectors
Manage database connectors for data generation and masking.
Synopsis
gomask connectors <subcommand> [OPTIONS]
Subcommands
| Command | Description |
|---|---|
list | List all database connectors |
create | Create a new database connector |
show | Display connector details |
test | Test connector connection |
delete | Delete 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
| Option | Type | Default | Description |
|---|---|---|---|
--name TEXT | string | (required) | Unique connector name |
--type TYPE | string | (required) | Database type (see below) |
--host TEXT | string | (required) | Database host address |
--port INTEGER | integer | auto | Database port (defaults based on type) |
--database TEXT | string | (required) | Database name |
--username TEXT | string | (required) | Database username |
--password TEXT | string | (prompted) | Database password (prompted securely if not provided) |
--password-env TEXT | string | none | Environment variable containing password |
--ssl-mode MODE | string | prefer | SSL mode: require, prefer, disable |
--skip-test | flag | false | Skip connection test after creation |
Supported Database Types
| Type | Default Port | Description |
|---|---|---|
postgresql | 5432 | PostgreSQL 10+ |
mysql | 3306 | MySQL 5.7+ / MariaDB 10.3+ |
oracle | 1521 | Oracle Database 12c+ |
sqlserver | 1433 | Microsoft SQL Server 2016+ |
mongodb | 27017 | MongoDB 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
| Argument | Description |
|---|---|
CONNECTOR_ID_OR_NAME | The 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
| Argument | Description |
|---|---|
CONNECTOR_ID_OR_NAME | The 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
| Argument | Description |
|---|---|
CONNECTOR_ID_OR_NAME | The connector's numeric ID or name |
Options
| Option | Type | Default | Description |
|---|---|---|---|
--force | flag | false | Delete 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
| Code | Description |
|---|---|
| 0 | Command completed successfully |
| 1 | Error (connection failed, not found, permission denied, etc.) |