client

package
v0.11.6 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ObjectsFromResult added in v0.9.0

func ObjectsFromResult(res *Result) map[string]*Objects

Types

type Client

type Client struct {
	External         bool
	History          []history.Record `json:"history"`
	ConnectionString string           `json:"connection_string"`
	// contains filtered or unexported fields
}

func New

func New() (*Client, error)

func NewFromUrl

func NewFromUrl(url string, sshInfo *shared.SSHInfo) (*Client, error)

func (*Client) Activity

func (client *Client) Activity() (*Result, error)

Returns all active queriers on the server

func (*Client) Close

func (client *Client) Close() error

Close database connection

func (*Client) Databases

func (client *Client) Databases() ([]string, error)

func (*Client) EstimatedTableRowsCount added in v0.10.0

func (client *Client) EstimatedTableRowsCount(table string, opts RowsOptions) (*Result, error)

func (*Client) Info

func (client *Client) Info() (*Result, error)

func (*Client) IsIdle added in v0.9.9

func (client *Client) IsIdle() bool

func (*Client) MaterializedView added in v0.9.0

func (client *Client) MaterializedView(name string) (*Result, error)

func (*Client) Objects added in v0.9.0

func (client *Client) Objects() (*Result, error)

func (*Client) Query

func (client *Client) Query(query string) (*Result, error)

func (*Client) Schemas

func (client *Client) Schemas() ([]string, error)

func (*Client) ServerVersion added in v0.9.9

func (client *Client) ServerVersion() string

func (*Client) SetReadOnlyMode added in v0.9.6

func (client *Client) SetReadOnlyMode() error

func (*Client) Table

func (client *Client) Table(table string) (*Result, error)

func (*Client) TableConstraints added in v0.7.0

func (client *Client) TableConstraints(table string) (*Result, error)

func (*Client) TableIndexes

func (client *Client) TableIndexes(table string) (*Result, error)

func (*Client) TableInfo

func (client *Client) TableInfo(table string) (*Result, error)

func (*Client) TableRows

func (client *Client) TableRows(table string, opts RowsOptions) (*Result, error)

func (*Client) TableRowsCount added in v0.8.0

func (client *Client) TableRowsCount(table string, opts RowsOptions) (*Result, error)

func (*Client) Test

func (client *Client) Test() error

type Dump added in v0.9.9

type Dump struct {
	Table string
}

func (*Dump) CanExport added in v0.10.0

func (d *Dump) CanExport() bool

func (*Dump) Export added in v0.9.9

func (d *Dump) Export(url string, writer io.Writer) error

type Objects added in v0.9.0

type Objects struct {
	Tables            []string `json:"table"`
	Views             []string `json:"view"`
	MaterializedViews []string `json:"materialized_view"`
	Sequences         []string `json:"sequence"`
}

type Pagination added in v0.8.0

type Pagination struct {
	Rows    int64 `json:"rows_count"`
	Page    int64 `json:"page"`
	Pages   int64 `json:"pages_count"`
	PerPage int64 `json:"per_page"`
}

type Result

type Result struct {
	Pagination *Pagination `json:"pagination,omitempty"`
	Columns    []string    `json:"columns"`
	Rows       []Row       `json:"rows"`
}

func (*Result) CSV

func (res *Result) CSV() []byte

func (*Result) Format

func (res *Result) Format() []map[string]interface{}

func (*Result) JSON added in v0.7.0

func (res *Result) JSON() []byte

func (*Result) PrepareBigints added in v0.8.0

func (res *Result) PrepareBigints()

Due to big int number limitations in javascript, numbers should be encoded as strings so they could be properly loaded on the frontend.

type Row

type Row []interface{}

type RowsOptions

type RowsOptions struct {
	Where      string // Custom filter
	Offset     int    // Number of rows to skip
	Limit      int    // Number of rows to fetch
	SortColumn string // Column to sort by
	SortOrder  string // Sort direction (ASC, DESC)
}

Struct to hold table rows browsing options

type Tunnel added in v0.9.0

type Tunnel struct {
	TargetHost string
	TargetPort string
	Port       int
	SSHInfo    *shared.SSHInfo
	Config     *ssh.ClientConfig
	Client     *ssh.Client
	Listener   *net.TCPListener
}

Tunnel represents the connection between local and remote server

func NewTunnel added in v0.9.0

func NewTunnel(sshInfo *shared.SSHInfo, dbUrl string) (*Tunnel, error)

NewTunnel instantiates a new tunnel struct from given ssh info

func (*Tunnel) Close added in v0.9.0

func (tunnel *Tunnel) Close()

Close closes the tunnel connection

func (*Tunnel) Configure added in v0.9.0

func (tunnel *Tunnel) Configure() error

Configure establishes the tunnel between localhost and remote machine

func (*Tunnel) Start added in v0.9.0

func (tunnel *Tunnel) Start()

Start starts the connection handler loop

Jump to

Keyboard shortcuts

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