godbc

package module
v0.0.0-...-2d3ecc3 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

README

godbc

Golang database connectivity API. This API is more flexible and extensible than golang's built-in database/sql package, because like JDBC, the API uses interfaces instead of concrete types. This allows it to be extended to handle both SQL and NoSQL / JSON data sources.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	Begin() (Tx, error)
	Close() error
	Exec(query string, args ...interface{}) (Result, error)
	Ping() error
	Prepare(query string) (Stmt, error)
	Query(query string, args ...interface{}) (Rows, error)
	QueryRow(query string, args ...interface{}) Row
	SetMaxIdleConns(n int)
	SetMaxOpenConns(n int)
	Stats() DBStats
}

type DBStats

type DBStats interface {
	OpenConnections() int
}

type DbSource

type DbSource interface {
	Open(dataSourceName string) (DB, error)
}

type Result

type Result interface {
	sql.Result // Inherit

	Rows() Rows // Possibly nil
}

type Row

type Row interface {
	Scan(dest ...interface{}) error
}

type Rows

type Rows interface {
	Close() error
	Columns() ([]string, error)
	Err() error
	Next() bool
	Scan(dest ...interface{}) error
}

type Stmt

type Stmt interface {
	Close() error
	Exec(args ...interface{}) (Result, error)
	Query(args ...interface{}) (Rows, error)
	QueryRow(args ...interface{}) Row
}

type Tx

type Tx interface {
	Commit() error
	Exec(query string, args ...interface{}) (Result, error)
	Prepare(query string) (Stmt, error)
	Query(query string, args ...interface{}) (Rows, error)
	QueryRow(query string, args ...interface{}) Row
	Rollback() error
	Stmt(stmt Stmt) Stmt
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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