scanner的性能比sqlx的select好些的样子
This commit is contained in:
parent
1ecfa19fd4
commit
00f788fad5
@ -84,7 +84,6 @@ func BenchmarkSelectXX(b *testing.B) {
|
||||
}
|
||||
func BenchmarkScannerXX(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
|
||||
_, err := scanners[options](anyDb[options](), ctx, Conditions())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@ -92,6 +91,16 @@ func BenchmarkScannerXX(b *testing.B) {
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkSqlXQueryXX(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
var r []options
|
||||
err := sq.Select(&r, "select * from wp_options")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type options struct {
|
||||
OptionId uint64 `gorm:"column:option_id" db:"option_id" json:"option_id" form:"option_id"`
|
||||
OptionName string `gorm:"column:option_name" db:"option_name" json:"option_name" form:"option_name"`
|
||||
|
Loading…
Reference in New Issue
Block a user