23 lines
493 B
Go
23 lines
493 B
Go
package export
|
||
|
||
import (
|
||
"math/rand"
|
||
)
|
||
|
||
type MysqlDataFetcher struct {
|
||
Config string
|
||
}
|
||
|
||
func (mf *MysqlDataFetcher) Fetch(sql string) []interface{} {
|
||
rows := make([]interface{}, 0, 6)
|
||
// 插入6个随机数组成的切片,模拟查询要返回的数据集
|
||
rows = append(rows, rand.Perm(5), rand.Perm(5), rand.Perm(5), rand.Perm(5), rand.Perm(5), rand.Perm(5))
|
||
return rows
|
||
}
|
||
|
||
func NewMysqlDataFetcher(configStr string) DataFetcher {
|
||
return &MysqlDataFetcher{
|
||
Config: configStr,
|
||
}
|
||
}
|