go-sqlrow: github.com/nasa9084/go-sqlrow Index | Examples | Files

package sqlrow

import "github.com/nasa9084/go-sqlrow"



Package Files



const (
    // ErrMustPointer is returned if given instance for Bind is not pointer
    ErrMustPointer bindErr = `binding destination instance must be a pointer`

func Bind Uses

func Bind(sc Scanner, i interface{}) error

Bind function for convenience

type Binder Uses

type Binder struct {
    // contains filtered or unexported fields

Binder binds sql row to golang type


db, _ := sql.Open("mysql", "...")
row := db.QueryRow("SELECT * FROM ...")
var ts testStruct
if err := sqlrow.NewBinder(row).Bind(&ts); err != nil {

func NewBinder Uses

func NewBinder(sc Scanner) *Binder

NewBinder returns a new Binder

func (*Binder) Bind Uses

func (binder *Binder) Bind(i interface{}) error

Bind binds row to given instance

type Scanner Uses

type Scanner interface {
    Scan(...interface{}) error

Scanner is wrapper interface of type like *sql.Row.

Package sqlrow imports 1 packages (graph). Updated 2018-03-05. Refresh now. Tools for package owners.