mirror of
https://github.com/asdine/storm.git
synced 2025-09-26 19:01:14 +08:00
Fix benchmarks. Fixes #219
This commit is contained in:
@@ -93,7 +93,7 @@ func BenchmarkOneByID(b *testing.B) {
|
|||||||
defer cleanup()
|
defer cleanup()
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
ID int
|
ID int `storm:"increment"`
|
||||||
Name string `storm:"index"`
|
Name string `storm:"index"`
|
||||||
age int
|
age int
|
||||||
DateOfBirth time.Time `storm:"index"`
|
DateOfBirth time.Time `storm:"index"`
|
||||||
|
@@ -9,8 +9,8 @@ import (
|
|||||||
"github.com/asdine/storm/codec/gob"
|
"github.com/asdine/storm/codec/gob"
|
||||||
"github.com/asdine/storm/codec/json"
|
"github.com/asdine/storm/codec/json"
|
||||||
"github.com/asdine/storm/q"
|
"github.com/asdine/storm/q"
|
||||||
bolt "go.etcd.io/bbolt"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
bolt "go.etcd.io/bbolt"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestInit(t *testing.T) {
|
func TestInit(t *testing.T) {
|
||||||
@@ -423,11 +423,11 @@ func TestSaveWithBatch(t *testing.T) {
|
|||||||
|
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func(i int) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
err := db.Save(&User{ID: i + 1, Name: "John"})
|
err := db.Save(&User{ID: i + 1, Name: "John"})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}()
|
}(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
@@ -62,7 +62,7 @@ type ClassicInline struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
ID int `storm:"id"`
|
ID int `storm:"id,increment"`
|
||||||
Name string `storm:"index"`
|
Name string `storm:"index"`
|
||||||
Age int `storm:"index,increment"`
|
Age int `storm:"index,increment"`
|
||||||
DateOfBirth time.Time `storm:"index"`
|
DateOfBirth time.Time `storm:"index"`
|
||||||
|
Reference in New Issue
Block a user