Skip to content

Commit

Permalink
do more locking with sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates committed Aug 15, 2016
1 parent 3ab4393 commit 7c45092
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,33 @@ func (m *SQLite) MigrationURL() string {
}

func (m *SQLite) Create(store Store, model *Model, cols Columns) error {
return genericCreate(store, model, cols)

return m.Lock(func() error {
return genericCreate(store, model, cols)
})
}

func (m *SQLite) Update(store Store, model *Model, cols Columns) error {
return genericUpdate(store, model, cols)

return m.Lock(func() error {
return genericUpdate(store, model, cols)
})
}

func (m *SQLite) Destroy(store Store, model *Model) error {
return genericDestroy(store, model)

return m.Lock(func() error {
return genericDestroy(store, model)
})
}

func (m *SQLite) SelectOne(store Store, model *Model, query Query) error {
return genericSelectOne(store, model, query)
return m.Lock(func() error {
return genericSelectOne(store, model, query)
})
}

func (m *SQLite) SelectMany(store Store, models *Model, query Query) error {
return genericSelectMany(store, models, query)
return m.Lock(func() error {
return genericSelectMany(store, models, query)
})
}

func (m *SQLite) Lock(fn func() error) error {
Expand Down

0 comments on commit 7c45092

Please sign in to comment.