client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2014 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SQLITE_INFO = `` /* 196-byte string literal not displayed */

	SQLITE_TABLES        = "SELECT name FROM sqlite_master WHERE type='table';"
	SQLITE_TABLE_SCHEMA  = "PRAGMA table_info(%s);"
	SQLITE_TABLE_INFO    = "SELECT COUNT(*) FROM %s;"
	SQLITE_TABLE_SQL     = "SELECT sql FROM sqlite_master WHERE type='table' AND name='%s'"
	SQLITE_TABLE_INDEXES = "SELECT * FROM sqlite_master WHERE type='index' AND tbl_name='%s'"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DbClient

type DbClient struct {
	DbFile string
	// contains filtered or unexported fields
}

func New

func New(file string) (*DbClient, error)

func (*DbClient) Info

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

func (*DbClient) Query

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

func (*DbClient) Table

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

Table returns the table structure.

func (*DbClient) TableIndexes

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

TableIndexes returns the indexes for the given table.

func (*DbClient) TableInfo

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

func (*DbClient) TableSql

func (client *DbClient) TableSql(table string) ([]string, error)

TableSql returns the SQL used to create the given table.

func (*DbClient) Tables

func (client *DbClient) Tables() ([]string, error)

type Result

type Result struct {
	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{}

Format returns a slice of maps. The key in the map represents the column name and the value is the row content.

type Row

type Row []interface{}

Jump to

Keyboard shortcuts

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