@@ -2,7 +2,9 @@ package main
22
33import (
44 "context"
5+ "errors"
56 "fmt"
7+ "io"
68 "path"
79 "strconv"
810 "time"
@@ -120,20 +122,23 @@ func (s *Storage) Read(ctx context.Context, entryID generator.RowID) (_ generato
120122
121123 rs , err := res .NextResultSet (ctx )
122124 if err != nil {
125+ if errors .Is (err , io .EOF ) {
126+ return nil
127+ }
128+
123129 return err
124130 }
125131
126132 row , err := rs .NextRow (ctx )
127133 if err != nil {
134+ if errors .Is (err , io .EOF ) {
135+ return nil
136+ }
137+
128138 return err
129139 }
130140
131- err = row .ScanNamed (
132- query .Named ("id" , & e .ID ),
133- query .Named ("payload_str" , & e .PayloadStr ),
134- query .Named ("payload_double" , & e .PayloadDouble ),
135- query .Named ("payload_timestamp" , & e .PayloadTimestamp ),
136- )
141+ err = row .ScanStruct (& e , query .WithAllowMissingColumnsFromSelect ())
137142 if err != nil {
138143 return err
139144 }
@@ -244,9 +249,10 @@ func (s *Storage) dropTable(ctx context.Context) error {
244249
245250 return s .db .Query ().Do (ctx ,
246251 func (ctx context.Context , session query.Session ) error {
247- _ , _ , err := session .Execute (ctx , `
248- DROP TABLE ` + "`" + path .Join (s .prefix , s .cfg .Table )+ "`" + `
249- ` )
252+ _ , _ , err := session .Execute (ctx ,
253+ fmt .Sprintf ("DROP TABLE `%s`" , path .Join (s .prefix , s .cfg .Table )),
254+ query .WithTxControl (query .NoTx ()),
255+ )
250256
251257 return err
252258 },
0 commit comments