Documentation
¶
Index ¶
- Constants
- func BuildDsn(userName, password, host, port, dbName, sslMode string) string
- func GetDbName() string
- type Backend
- func (b *Backend) Close() error
- func (b *Backend) ColumnIndexTypes(namespace, table string) (map[string]string, error)
- func (b *Backend) ColumnsMeta(namespace, table string) ([]db.ColumnMeta, error)
- func (b *Backend) CurrentNamespace() string
- func (b *Backend) FetchTable(namespace, table string, limit int) (*data.Frame, error)
- func (b *Backend) Kind() string
- func (b *Backend) Namespaces() ([]string, error)
- func (b *Backend) PrimaryKeys(namespace, table string) ([]string, error)
- func (b *Backend) Run(stmt string) (db.Result, error)
- func (b *Backend) Tables(namespace string) ([]string, error)
- func (b *Backend) Title() string
- type Config
- type DB
- func (db *DB) ColumnIndexTypes(schema, table string) (map[string]string, error)
- func (db *DB) ColumnsMeta(schema, table string) ([]dbapi.ColumnMeta, error)
- func (db *DB) FetchTableRecords(schema, table string) (fields []string, records [][]string, err error)
- func (db *DB) ListPrimaryKeys(schema, table string) ([]string, error)
- func (db *DB) ListSchemas() ([]string, error)
- func (db *DB) ListTables(schema string) ([]string, error)
- func (db *DB) RawExec(query string) (sql.Result, error)
- func (db *DB) RawQuery(query string) (fields []string, records [][]string, err error)
- func (db *DB) RawSqlCommand(query string) (rawCmdResult RawCommandResult, err error)
- type RawCommandResult
Constants ¶
const ( // DQL keywords SELECT = "select" WITH = "with" SHOW = "show" EXPLAIN = "explain" VALUES = "values" TABLE = "table" // max rows fetched when browsing a table from the tree view FetchLimit = 200 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend adapts the postgres data-access layer to the db.Backend contract.
func (*Backend) ColumnIndexTypes ¶
ColumnIndexTypes returns index type labels for indexed columns of namespace.table.
func (*Backend) ColumnsMeta ¶
func (b *Backend) ColumnsMeta(namespace, table string) ([]db.ColumnMeta, error)
ColumnsMeta returns column metadata for namespace.table.
func (*Backend) CurrentNamespace ¶
CurrentNamespace reports the schema new objects resolve to on this connection (usually "public"), so browsers can scope their listing to it (optional interface, not part of db.Backend).
func (*Backend) FetchTable ¶
FetchTable loads up to limit rows of namespace.table.
func (*Backend) Namespaces ¶
Namespaces lists the user schemas of the database.
func (*Backend) PrimaryKeys ¶
PrimaryKeys lists the primary-key column names of namespace.table.
func (*Backend) Run ¶
Run executes a statement with the same DQL / RETURNING routing as the underlying data-access layer, but scans query results into typed frame cells instead of pre-rendered strings.
type Config ¶
type Config struct {
UserName string
Password string
Host string
Port string
DbName string
SslMode string
}
Config holds the connection parameters for a PostgreSQL server.
type DB ¶
var (
DbClient *DB
)
func (*DB) ColumnIndexTypes ¶
ColumnIndexTypes returns a column→index-type map for schema.table. Priority: PK > UNIQUE > INDEX.
func (*DB) ColumnsMeta ¶
func (db *DB) ColumnsMeta(schema, table string) ([]dbapi.ColumnMeta, error)
ColumnsMeta returns column metadata for schema.table, in ordinal order. Column comments are resolved via col_description.
func (*DB) FetchTableRecords ¶
func (*DB) ListPrimaryKeys ¶
ListPrimaryKeys lists the primary-key column names of schema.table, in index-ordinal order. Empty when the table has no primary key.
func (*DB) ListSchemas ¶
func (*DB) RawSqlCommand ¶
func (db *DB) RawSqlCommand(query string) (rawCmdResult RawCommandResult, err error)