dsparser

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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

View Source
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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL