Overview
Poge uses two primary interfaces for managing PostgreSQL server connections:ServerConnection for stored connections with metadata, and ServerFormData for connection form input.
ServerConnection
Represents a saved PostgreSQL server connection with full metadata.Interface Definition
From/types/server.ts:1-14:
Fields
Unique identifier for the connection (UUID)Example:
"550e8400-e29b-41d4-a716-446655440000"Human-readable connection nameExample:
"Production Database", "Local Dev"PostgreSQL server hostname or IP addressExample:
"localhost", "db.example.com"PostgreSQL server port numberDefault:
5432Target database nameExample:
"myapp_production"PostgreSQL username for authenticationExample:
"postgres", "app_user"PostgreSQL user password
SSL connection modeOptions:
"disable"- No SSL"require"- Require SSL (allows self-signed certificates)"prefer"- Try SSL first, fallback to non-SSL
"disable"Current connection status
true- Connection is active/establishedfalse- Connection is inactive
Whether connection is marked as favoriteUsed for sorting/filtering in UI
Timestamp when connection was createdExample:
new Date("2024-01-15T10:30:00Z")Timestamp of last successful connection
undefined if never connectedExample
Use Cases
- Connection List: Display saved connections in sidebar
- Connection Switching: Switch between multiple databases
- Recent Connections: Sort by
lastConnectedfor quick access - Favorites: Filter favorite connections for quick access
ServerFormData
Represents form input data for creating or editing server connections.Interface Definition
From/types/server.ts:16-25:
Fields
Human-readable connection name
PostgreSQL server hostname or IP address
PostgreSQL server port number
Target database name
PostgreSQL username for authentication
PostgreSQL user password
SSL connection mode (
"disable", "require", "prefer")PostgreSQL connection string (alternative to individual fields)Format:
postgresql://username:password@host:port/database?sslmode=requireWhen provided, parsed into individual fieldsExample
Connection String Example
Use Cases
- Connection Form: Capture user input for new connections
- Connection Editing: Update existing connection properties
- Connection String Import: Parse PostgreSQL connection strings
- Form Validation: Validate required fields before saving
Type Conversion
ConvertServerFormData to ServerConnection:
Validation Example
Security Considerations
Related Types
See also:- Database Objects - Schema and table types
- Query Results - Query execution types