github.com/kunlun-qilian/sqlx/v3@v3.0.0/super_scan.go (about)

     1  package sqlx
     2  
     3  import (
     4  	"context"
     5  	"database/sql"
     6  
     7  	"github.com/kunlun-qilian/sqlx/v3/scanner"
     8  )
     9  
    10  type ScanIterator = scanner.ScanIterator
    11  
    12  func Scan(rows *sql.Rows, v interface{}) error {
    13  	if err := scanner.Scan(context.Background(), rows, v); err != nil {
    14  		if err == scanner.RecordNotFound {
    15  			return NewSqlError(sqlErrTypeNotFound, "record is not found")
    16  		}
    17  		return err
    18  	}
    19  	return nil
    20  }