connectorpostgresql

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: May 20, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package connectorpostgresql has ready-made database/sql/driver.Connector for github.com/lib/pq.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnector

func NewConnector(ctx context.Context, dsn string) (driver.Connector, error)

Function NewConnector is a wrapper for github.com/lib/pq.

Input

Output

Example
package main

import (
	"context"
	"fmt"

	"github.com/senzing-garage/go-databasing/connectorpostgresql"
)

func main() {
	// For more information, visit https://github.com/senzing-garage/go-databasing/blob/main/connectorpostgresql/connectorpostgresql_examples_test.go
	ctx := context.TODO()
	// See https://pkg.go.dev/github.com/lib/pq#hdr-Connection_String_Parameters
	configuration := "user=postgres password=postgres dbname=G2 host=localhost sslmode=disable"
	databaseConnector, err := connectorpostgresql.NewConnector(ctx, configuration)
	failOnError(err)

	_ = databaseConnector // Faux use of databaseConnector
}

func failOnError(err error) {
	if err != nil {
		fmt.Println(err)
	}
}
Example (Null)
package main

import ()

func main() {
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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