{"modulePath":"github.com/Braidplane/braidplane-core","version":"v0.5.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package postgres\n\n## Types\n\n```go\ntype Config struct {\n\t// DialFunc is supplied only by trusted runtime wiring, never by a source payload.\n\tAuthorize         func(context.Context) error `json:\"-\"`\n\tMaxConns          int                         `json:\"-\"`\n\tDialFunc          pgconn.DialFunc             `json:\"-\"`\n\tHost              string                      `json:\"host\"                      validate:\"required,hostname|ip\"`\n\tPort              int                         `json:\"port\"                      validate:\"required,min=1,max=65535\"`\n\tDatabase          string                      `json:\"database\"                  validate:\"required\"`\n\tSSLMode           string                      `json:\"ssl_mode,omitempty\"`\n\tUser              string                      `json:\"user\"                      validate:\"required\"`\n\tPassword          string                      `json:\"password\"                  validate:\"required\"`\n\tConnectTimeout    int                         `json:\"connect_timeout,omitempty\"`\n\tAllowPrivateHosts bool                        `json:\"allow_private_hosts,omitempty\"`\n}\n```\nConfig holds configuration for PostgreSQL connections.\n\n```go\ntype Connector struct {\n\t// contains filtered or unexported fields\n}\n```\nConnector connects to PostgreSQL databases via pgx.\n\n```go\nfunc New(ctx context.Context, config Config) (*Connector, error)\n```\nNew creates a new PostgreSQL connector with the provided configuration.\n\n```go\nfunc (c *Connector) Close() error\n```\nClose closes the database connection pool.\n\n```go\nfunc (c *Connector) Execute(\n\tctx context.Context,\n\tqueryData json.RawMessage,\n\tparams map[string]types.TypedParam,\n\tlimits ...types.ExecutionLimits,\n) (*result.ExecutionResult, error)\n```\nExecute runs the SQL query described by queryData and returns the results.\n\n```go\nfunc (c *Connector) ExecuteStatement(\n\tctx context.Context,\n\tstmt string,\n\targs []any,\n) (sqlconnector.Result, error)\n```\nExecuteStatement runs a parameterized SQL statement with ordered positional arguments. Placeholders in stmt must use PostgreSQL $N notation matching the order of args.\n\n```go\nfunc (c *Connector) GetCapabilities() sqlconnector.Capabilities\n```\nGetCapabilities returns the capabilities supported by PostgreSQL connector.\n\n```go\nfunc (c *Connector) IntrospectSchema(ctx context.Context) (*sqlconnector.Schema, error)\n```\nIntrospectSchema retrieves the schema of the PostgreSQL database.\n\n```go\nfunc (c *Connector) SQLPoolStats() stdsql.DBStats\n```\nSQLPoolStats returns a safe point-in-time snapshot of the underlying pool.\n\n```go\nfunc (c *Connector) TestConnection(ctx context.Context) error\n```\nTestConnection verifies that a connection to PostgreSQL can be established.\n\n```go\ntype Credentials struct {\n\tUsername string `json:\"username\" validate:\"required\"`\n\tPassword string `json:\"password\" validate:\"required\"`\n}\n```\nCredentials holds PostgreSQL authentication values.\n\n```go\ntype TableMetadataObserver struct {\n\tsqlconnector.TableMetadataResource\n}\n```\n\n```go\nfunc (o TableMetadataObserver) AssessMetadata(raw json.RawMessage) (model.ProofVerdict, []model.ProofDiagnostic, error)\n```\n\n```go\nfunc (o TableMetadataObserver) Description() string\n```\n\n```go\nfunc (o TableMetadataObserver) MatchesResource(config, operation json.RawMessage, source bool) bool\n```\n\n```go\nfunc (o TableMetadataObserver) Plan() (proofevidence.MetadataPlan, error)\n```\n\n```go\nfunc (o TableMetadataObserver) ReadMetadata(ctx context.Context, transport proofevidence.MetadataIO, credential []byte, limits proofevidence.Limits) (json.RawMessage, int64, proofevidence.Outcome)\n```\n\n","path":"github.com/Braidplane/braidplane-core/connector/sql/postgres","name":"postgres","synopsis":"","isRedistributable":true}
