Removing AutoIncrement option

This commit is contained in:
Asdine El Hrychy
2017-09-12 19:20:14 +02:00
parent 5b5aa3b09f
commit 9acbcb56a2
10 changed files with 25 additions and 73 deletions

View File

@@ -10,6 +10,7 @@ import (
"time"
"github.com/asdine/storm"
"github.com/asdine/storm/codec/gob"
"github.com/boltdb/bolt"
)
@@ -18,7 +19,7 @@ func ExampleDB_Save() {
defer os.RemoveAll(dir)
type User struct {
ID int `storm:"id"`
ID int `storm:"id,increment"`
Group string `storm:"index"`
Email string `storm:"unique"`
Name string
@@ -28,7 +29,7 @@ func ExampleDB_Save() {
// Open takes an optional list of options as the last argument.
// AutoIncrement will auto-increment integer IDs without existing values.
db, _ := storm.Open(filepath.Join(dir, "storm.db"), storm.AutoIncrement())
db, _ := storm.Open(filepath.Join(dir, "storm.db"), storm.Codec(gob.Codec))
defer db.Close()
user := User{
@@ -497,7 +498,7 @@ func ExampleNode_RangeScan() {
}
type User struct {
ID int `storm:"id"`
ID int `storm:"id,increment"`
Group string `storm:"index"`
Email string `storm:"unique"`
Name string
@@ -506,7 +507,7 @@ type User struct {
}
type Account struct {
ID int `storm:"id"`
ID int `storm:"id,increment"`
Amount int64 // amount in cents
}
@@ -517,7 +518,7 @@ type Note struct {
func prepareDB() (string, *storm.DB) {
dir, _ := ioutil.TempDir(os.TempDir(), "storm")
db, _ := storm.Open(filepath.Join(dir, "storm.db"), storm.AutoIncrement())
db, _ := storm.Open(filepath.Join(dir, "storm.db"))
for i, name := range []string{"John", "Eric", "Dilbert"} {
email := strings.ToLower(name + "@provider.com")