|
@@ -61,6 +61,24 @@ var _ = Describe("gosql", func() {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -98,6 +116,24 @@ var _ = Describe("gosql", func() {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -144,6 +180,28 @@ var _ = Describe("gosql", func() {
|
|
|
|
|
|
Expect(db.Close()).To(Succeed())
|
|
|
})
|
|
|
+
|
|
|
+ It("open connection, migrate and check row", func() {
|
|
|
+ f, err := ioutil.TempFile("", "go-sqlite-test-")
|
|
|
+ Expect(err).To(Succeed())
|
|
|
+ f.Close()
|
|
|
+
|
|
|
+ db, err := gosql.Open("sqlite://"+f.Name(), migrationsDir, false, false)
|
|
|
+ Expect(err).To(Succeed())
|
|
|
+
|
|
|
+ var rowUser struct {
|
|
|
+ ID int64 `field:"id" table:"users"`
|
|
|
+ Name string `field:"name"`
|
|
|
+ }
|
|
|
+
|
|
|
+ Expect(db.RowExists(ctx, 1, &rowUser)).To(BeTrue())
|
|
|
+ Expect(db.RowExists(ctx, 2, &rowUser)).To(BeTrue())
|
|
|
+ Expect(db.RowExists(ctx, 3, &rowUser)).To(BeFalse())
|
|
|
+ Expect(db.RowExists(ctx, 4, &rowUser)).To(BeFalse())
|
|
|
+ Expect(db.RowExists(ctx, 5, &rowUser)).To(BeFalse())
|
|
|
+
|
|
|
+ Expect(db.Close()).To(Succeed())
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
It("open connection and skip migration", func() {
|