qrunner

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// TextFieldTerm is field name from ui, indicating all text fields
	TextFieldTerm = "*text*"
	TextSqlNames  = []string{
		"varchar",
		"text",
		"char",
		"nchar",
		"nvarchar",
		"ntext",
	}
)
View Source
var QrunnerNotInitialized = errors.New("not connected to database")

QrunnerNotInitialized not connected to database

Functions

This section is empty.

Types

type Field

type Field struct {
	Name     string
	Type     string
	Nullable string
	Default  string
}

type Metatype

type Metatype string
const (
	DescribeTable Metatype = "DescribeTable"
	ListTables    Metatype = "ListTables"
	ListDatabases Metatype = "ListDatabases"
)

type Qrunner

type Qrunner struct {
	// contains filtered or unexported fields
}

Qrunner holds database handle and executes requested queries

func New

func New(dsn string) (*Qrunner, error)

func (*Qrunner) Close

func (q *Qrunner) Close() error

func (*Qrunner) Dsn

func (q *Qrunner) Dsn() string

func (*Qrunner) Metacmd

func (q *Qrunner) Metacmd(ctx context.Context, cmd Metatype, param string, outjson bool) (*Result, error)

func (*Qrunner) QsearchMakeQuery

func (q *Qrunner) QsearchMakeQuery(ctx context.Context, tblname, field, search string) (string, error)

func (*Qrunner) Query

func (q *Qrunner) Query(ctx context.Context, sqlstr string, outjson bool) (*Result, error)

type Result

type Result struct {
	Rows    [][]string
	Header  []string
	Timing  string
	ResJson string
}

Result has results of metacmd or sql query execution

func Drivers

func Drivers() (*Result, error)

type Table

type Table struct {
	Name   string
	Fields []Field
}

Jump to

Keyboard shortcuts

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