minisql

package
v0.0.0-...-54ee1dd Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Package minisql defines the subset of interfaces from database/sql that's needed to support pathdb. The interfaces are optimized for use with gomobile.

Index

Constants

View Source
const (
	ValueTypeBytes  = 0
	ValueTypeString = 1
	ValueTypeInt    = 2
	ValueTypeBool   = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	Exec(query string, args Values) error
	Query(query string, args Values) (Rows, error)
	Begin() (Tx, error)
}

type DBAPI

type DBAPI struct {
	*QueryableAPI
	// contains filtered or unexported fields
}

func Wrap

func Wrap(db DB) *DBAPI

func (*DBAPI) Begin

func (db *DBAPI) Begin() (*TxAPI, error)

type DBAdapter

type DBAdapter struct {
	*sql.DB
}

func (*DBAdapter) Begin

func (db *DBAdapter) Begin() (Tx, error)

func (*DBAdapter) Exec

func (db *DBAdapter) Exec(query string, args Values) error

func (*DBAdapter) Query

func (db *DBAdapter) Query(query string, args Values) (Rows, error)

type Queryable

type Queryable interface {
	Exec(query string, args Values) error
	Query(query string, args Values) (Rows, error)
}

type QueryableAPI

type QueryableAPI struct {
	Queryable
}

func (*QueryableAPI) Exec

func (q *QueryableAPI) Exec(query string, args ...interface{}) error

func (*QueryableAPI) Query

func (q *QueryableAPI) Query(query string, args ...interface{}) (ScannableRows, error)

type Rows

type Rows interface {
	Close() error
	Next() bool
	Scan(values Values) error
}

type ScannableRows

type ScannableRows interface {
	Close() error
	Next() bool
	Scan(args ...interface{}) error
}

type Tx

type Tx interface {
	Exec(query string, args Values) error
	Query(query string, args Values) (Rows, error)
	Commit() error
	Rollback() error
}

type TxAPI

type TxAPI struct {
	*QueryableAPI
	// contains filtered or unexported fields
}

func (*TxAPI) Commit

func (tx *TxAPI) Commit() error

func (*TxAPI) Rollback

func (tx *TxAPI) Rollback() error

type TxAdapter

type TxAdapter struct {
	*sql.Tx
}

func (*TxAdapter) Exec

func (tx *TxAdapter) Exec(query string, args Values) error

func (*TxAdapter) Query

func (tx *TxAdapter) Query(query string, args Values) (Rows, error)

type Value

type Value struct {
	Type int
	// contains filtered or unexported fields
}

func NewValue

func NewValue(i interface{}) *Value

func NewValueBool

func NewValueBool(i bool) *Value

func NewValueBytes

func NewValueBytes(i []byte) *Value

func NewValueInt

func NewValueInt(i int) *Value

func NewValueString

func NewValueString(i string) *Value

func (*Value) Bool

func (v *Value) Bool() bool

func (*Value) Bytes

func (v *Value) Bytes() []byte

func (*Value) Int

func (v *Value) Int() int

func (*Value) SetBool

func (v *Value) SetBool(s bool)

func (*Value) SetBytes

func (v *Value) SetBytes(i []byte)

func (*Value) SetInt

func (v *Value) SetInt(i int)

func (*Value) SetString

func (v *Value) SetString(s string)

func (*Value) String

func (v *Value) String() string

type Values

type Values interface {
	Len() int
	Get(index int) *Value
}

func NewValues

func NewValues(vals []interface{}) Values

Jump to

Keyboard shortcuts

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