excel-export/biz/export/mysql_data_fetcher.go

23 lines
493 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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,
}
}