No need for PutC as we always already have the record value

We don’t need to check whether the record already exists, as we always have any record contents when we are procesing a document. Therefore we already know if a document exists or not in the kv store.
This commit is contained in:
Tobie Morgan Hitchcock 2018-02-08 10:59:54 +00:00
parent dc6a357e26
commit 8cce4ad185
4 changed files with 3 additions and 28 deletions

View file

@ -128,7 +128,7 @@ func (d *document) runCreate(ctx context.Context, stm *sql.CreateStatement) (int
return nil, err
}
if err = d.startThing(); err != nil {
if err = d.storeThing(); err != nil {
return nil, err
}

View file

@ -306,31 +306,6 @@ func (d *document) shouldDrop() (bool, error) {
}
func (d *document) startThing() (err error) {
// Check that the table should
// drop data being written.
if ok, err := d.shouldDrop(); ok {
return err
}
// Check that the rcord has been
// changed, and if not, return.
if ok := d.changed(); !ok {
return
}
// Write the value to the data
// layer and return any errors.
_, err = d.i.e.dbo.PutC(d.now, d.key.Encode(), d.current.Encode(), nil)
return
}
func (d *document) storeThing() (err error) {
// Check that the table should

View file

@ -106,7 +106,7 @@ func (d *document) runInsert(ctx context.Context, stm *sql.InsertStatement) (int
return nil, err
}
if err = d.startThing(); err != nil {
if err = d.storeThing(); err != nil {
return nil, err
}

View file

@ -120,7 +120,7 @@ func (d *document) runRelate(ctx context.Context, stm *sql.RelateStatement) (int
return nil, err
}
if err = d.startThing(); err != nil {
if err = d.storeThing(); err != nil {
return nil, err
}