Skip to content

Commit 6118355

Browse files
committed
Revert "Import the driver with the dialect"
This reverts commit 49099d9.
1 parent 49099d9 commit 6118355

File tree

1 file changed

+0
-49
lines changed

1 file changed

+0
-49
lines changed

dialect.go

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
package gorm
22

33
import (
4-
"database/sql"
5-
"database/sql/driver"
64
"fmt"
75
"reflect"
86
"strings"
97
"time"
108

11-
_ "github.com/lib/pq"
12-
"github.com/lib/pq/hstore"
139
"github.com/ngorm/common"
1410
"github.com/ngorm/ngorm/model"
1511
)
@@ -161,48 +157,3 @@ func isUUID(value reflect.Value) bool {
161157
lower := strings.ToLower(typename)
162158
return "uuid" == lower || "guid" == lower
163159
}
164-
165-
type Hstore map[string]*string
166-
167-
// Value get value of Hstore
168-
func (h Hstore) Value() (driver.Value, error) {
169-
hstore := hstore.Hstore{Map: map[string]sql.NullString{}}
170-
if len(h) == 0 {
171-
return nil, nil
172-
}
173-
174-
for key, value := range h {
175-
var s sql.NullString
176-
if value != nil {
177-
s.String = *value
178-
s.Valid = true
179-
}
180-
hstore.Map[key] = s
181-
}
182-
return hstore.Value()
183-
}
184-
185-
// Scan scan value into Hstore
186-
func (h *Hstore) Scan(value interface{}) error {
187-
hstore := hstore.Hstore{}
188-
189-
if err := hstore.Scan(value); err != nil {
190-
return err
191-
}
192-
193-
if len(hstore.Map) == 0 {
194-
return nil
195-
}
196-
197-
*h = Hstore{}
198-
for k := range hstore.Map {
199-
if hstore.Map[k].Valid {
200-
s := hstore.Map[k].String
201-
(*h)[k] = &s
202-
} else {
203-
(*h)[k] = nil
204-
}
205-
}
206-
207-
return nil
208-
}

0 commit comments

Comments
 (0)