client

package
v0.0.0-...-efc39ba Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ObjectsFromResult

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

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

func (*Client) Info

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

func (*Client) IsIdle

func (client *Client) IsIdle() bool

func (*Client) MaterializedView

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

func (*Client) Objects

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

func (client *Client) ServerVersion() string

func (*Client) SetReadOnlyMode

func (client *Client) SetReadOnlyMode() error

func (*Client) Table

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

func (*Client) TableConstraints

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

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

func (*Client) Test

func (client *Client) Test() error

type Dump

type Dump struct {
	Table string
}

func (*Dump) CanExport

func (d *Dump) CanExport() bool

func (*Dump) Export

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

type Objects

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

type Pagination

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

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

func (*Result) PrepareBigints

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

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

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

NewTunnel instantiates a new tunnel struct from given ssh info

func (*Tunnel) Close

func (tunnel *Tunnel) Close()

Close closes the tunnel connection

func (*Tunnel) Configure

func (tunnel *Tunnel) Configure() error

Configure establishes the tunnel between localhost and remote machine

func (*Tunnel) Start

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