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 module, 1 package

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.

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
⌂ 换网址