client

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package client implements a client for the PostgreSQL through HTTP wpsql server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*slog.Logger
	*http.Client
	URL, DB, Secret string
}

Client is a wpsql client. URL must be the URL of the wpsql server. DB is the target database. Secretus needed for data modification only.

func (Client) Exec

func (m Client) Exec(ctx context.Context, qry string, params ...string) error

Exec a query.

func (Client) Query

func (m Client) Query(ctx context.Context, qry string, params ...string) ([][]interface{}, error)

Query the database.

func (Client) QueryStrings added in v0.4.0

func (m Client) QueryStrings(ctx context.Context, qry string, params ...string) ([][]string, error)

QueryStrings returns the query's results as []string the database.

func (Client) QueryStringsWalk added in v0.4.0

func (m Client) QueryStringsWalk(ctx context.Context, callback func([]string) error, qry string, params ...string) error

QueryStringsWalk calls the given callback for each row. It quits with the error if the callbacks returns an error.

func (Client) QueryWalk added in v0.1.0

func (m Client) QueryWalk(ctx context.Context, callback func([]interface{}) error, qry string, params ...string) error

QueryWalk calls the given callback for each row. It quits with the error if the callbacks returns an error.

Jump to

Keyboard shortcuts

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