Documentation
¶
Overview ¶
Package dsparser provides connection URI parsers for each supported datasource type. Each parser converts a canonical connection URI into structured fields that match the API schema's config and credentials for that datasource.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedScheme = xerror.UnsupportedURIScheme()
ErrUnsupportedScheme is returned when the URI scheme does not match the expected datasource type.
Functions ¶
This section is empty.
Types ¶
type ParsedFields ¶
type ParsedFields struct {
// Common connection fields
Host string
Port int
Database string
// Credentials
Username string
Password string
// PostgreSQL-specific
SSLMode string
// MongoDB-specific
AuthDatabase string
// HTTP-specific
BaseURL string
HealthPath string
BearerToken string
}
ParsedFields holds the structured fields extracted from a connection URI. Only fields relevant to the parsed datasource type will be populated.
func ParseHTTP ¶
func ParseHTTP(uri string) (*ParsedFields, error)
ParseHTTP parses an HTTP/HTTPS service URI. Supported schemes: http, https. The full URI (scheme + host + port) becomes BaseURL; the path becomes HealthPath. Example: https://api.example.com:8443/health
func ParseMongoDB ¶
func ParseMongoDB(uri string) (*ParsedFields, error)
ParseMongoDB parses a MongoDB connection URI. Supported schemes: mongodb, mongodb+srv. Example: mongodb://user:pass@host:27017/dbname?authSource=admin
func ParseMySQL ¶
func ParseMySQL(uri string) (*ParsedFields, error)
ParseMySQL parses a MySQL connection URI. Supported schemes: mysql. Example: mysql://user:pass@host:3306/dbname
func ParsePostgres ¶
func ParsePostgres(uri string) (*ParsedFields, error)
ParsePostgres parses a PostgreSQL connection URI. Supported schemes: postgres, postgresql. Example: postgres://user:pass@host:5432/dbname?sslmode=disable