client

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2016 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PORT_START = 29168
	PORT_LIMIT = 500
)

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 {
	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) Info

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

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) 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 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
}

func NewTunnel added in v0.9.0

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

func (*Tunnel) Close added in v0.9.0

func (tunnel *Tunnel) Close()

func (*Tunnel) Configure added in v0.9.0

func (tunnel *Tunnel) Configure() error

func (*Tunnel) Start added in v0.9.0

func (tunnel *Tunnel) Start()

Jump to

Keyboard shortcuts

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