qrunner

package
v0.0.4 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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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