client

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is used to store the pool of db connection.

func New

func New(opts command.Options) (*Client, error)

New return an instance of the client.

func (*Client) Catalog added in v0.39.0

func (c *Client) Catalog(ctx context.Context) (*DBNode, error)

func (*Client) DB

func (c *Client) DB() *sqlx.DB

DB Return the db attribute.

func (*Client) Driver

func (c *Client) Driver() string

Driver returns the driver of the database.

func (*Client) Host added in v0.39.0

func (c *Client) Host() string

func (*Client) Metadata added in v0.15.0

func (c *Client) Metadata(table TableRef) (*Metadata, error)

Metadata returns the most relevant data from a given table.

func (*Client) Query added in v0.2.0

func (c *Client) Query(q string, args ...any) ([][]string, []string, error)

Query returns performs the query and returns the result set and the column names.

func (*Client) ViewMetadata added in v0.41.0

func (c *Client) ViewMetadata(view ViewRef) (*Metadata, error)

ViewMetadata returns the most relevant data from a given view. It returns the view sql definition.

type DBNode added in v0.39.0

type DBNode struct {
	ID string
	// Name is used to display on the TUI.
	Name string
	// EntityName is used to run queries.
	EntityName string
	Type       string
	ParentID   string
	ParentName string
	Children   []*DBNode
}

type Metadata added in v0.15.0

type Metadata struct {
	TableContent Table
	Structure    Table
	Constraints  Table
	Indexes      Table
	ViewDef      Table
	TotalPages   int
}

Metadata sums up the most relevant data from a table.

type Table added in v0.15.0

type Table struct {
	Rows    [][]string
	Columns []string
	// contains filtered or unexported fields
}

Table represents a SQL table.

func (*Table) Name added in v0.16.2

func (t *Table) Name() string

type TableRef added in v0.39.0

type TableRef struct {
	Schema string
	Name   string
}

type ViewRef added in v0.41.0

type ViewRef struct {
	Schema string
	Name   string
}

Jump to

Keyboard shortcuts

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