sqldriver

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: MIT Imports: 4 Imported by: 1

README

go-sql-driver

This module is intended to provide a wrapper of database/sql/driver in golang to easy writing new drivers.

Installation

go-sql-driver fully go-getable without any dependency, So just type

go get github.com/rosbit/go-sql-driver

Usage

driver_test.go provides a sample of driver. Run go test to see the result.

Contribution

Pull requests are welcome! Also, if you want to discuss something, send a pull request with proposal and changes.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(wrapper DriverWrapper)

Types

type DriverWrapper

type DriverWrapper interface {
	GetDriverName() string
	CreateConnection(dsn string) (interface{}, error)
	CloseConnection(conn interface{}) error
	Ping(conn interface{}) error
	BeginTx(conn interface{}, opts driver.TxOptions) (interface{}, error)
	Commit(tx interface{}) error
	Rollback(tx interface{}) error
	Prepare(conn interface{}, query string) (interface{}, error)
	CloseStmt(stmt interface{}) error
	Exec(stmt interface{}, args ...interface{}) (ExecResult, error)
	Query(stmt interface{}, args ...interface{}) (ResultSet, error)
}

type ExecResult

type ExecResult interface {
	LastInsertId() (int64, error)
	RowsAffected() (int64, error)
}

type ResultSet

type ResultSet interface {
	Columns() []string
	Close() error
	Next(dest []interface{}) error
}

Jump to

Keyboard shortcuts

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