postgres

package
v3.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: MIT, Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PGClient

type PGClient struct{}

PGClient is a client for Postgres database.

Internally client uses go-pg/pg driver.

func (*PGClient) Connect

func (c *PGClient) Connect(host string, port int, username, password string) (bool, error)

Connect connects to Postgres database using given credentials.

If connection is successful, it returns true. If connection is unsuccessful, it returns false and error.

The connection is closed after the function returns.

func (*PGClient) ConnectWithDB

func (c *PGClient) ConnectWithDB(host string, port int, username, password, dbName string) (bool, error)

ConnectWithDB connects to Postgres database using given credentials and database name.

If connection is successful, it returns true. If connection is unsuccessful, it returns false and error.

The connection is closed after the function returns.

func (*PGClient) ExecuteQuery

func (c *PGClient) ExecuteQuery(host string, port int, username, password, dbName, query string) (string, error)

ExecuteQuery connects to Postgres database using given credentials and database name. and executes a query on the db.

func (*PGClient) IsPostgres

func (c *PGClient) IsPostgres(host string, port int) (bool, error)

IsPostgres checks if the given host and port are running Postgres database.

If connection is successful, it returns true. If connection is unsuccessful, it returns false and error.

Jump to

Keyboard shortcuts

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