add vendor packages避免用户网络太慢无法下载编译

This commit is contained in:
hebo
2019-08-09 11:36:20 +08:00
parent 057559d437
commit 28661b662d
314 changed files with 73688 additions and 1 deletions

54
vendor/github.com/zr-hebo/util-db/scanner.go generated vendored Normal file
View File

@@ -0,0 +1,54 @@
package db
import (
"database/sql"
"fmt"
)
// CheckPair CheckPair
type CheckPair struct {
Host
UserErp string `json:"erp"`
DBName string `json:"dbname"`
}
func (cp *CheckPair) String() string {
return fmt.Sprintf(
"check if %s can visit %s@%s:%d", cp.UserErp, cp.DBName, cp.IP, cp.Port)
}
// Scanner SQL rows读取器
type Scanner interface {
Scan(*sql.Rows, ...*string) error
}
type showNullScanner struct {
}
// NewShowNullScanner 显示NULL值的接收器要求Scan的时候传入的参数是string类型
func NewShowNullScanner() (s Scanner) {
return new(showNullScanner)
}
func (ns *showNullScanner) Scan(
rows *sql.Rows, receivers ...*string) (err error) {
nullReceivers := make([]interface{}, 0, len(receivers))
for range receivers {
nullReceivers = append(nullReceivers, &sql.NullString{})
}
if err = rows.Scan(nullReceivers...); err != nil {
return
}
for i, rv := range nullReceivers {
nullReceiver := rv.(*sql.NullString)
if nullReceiver.Valid {
*receivers[i] = nullReceiver.String
} else {
*receivers[i] = "NULL"
}
}
return
}