Skip to content

Commit 148fa79

Browse files
authored
Add support for JSON column type (#4)
1 parent 562d2bc commit 148fa79

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ module github.com/go-rel/postgres
33
go 1.17
44

55
require (
6-
github.com/go-rel/rel v0.25.1-0.20211011102656-a1b38f01d34a
7-
github.com/go-rel/sql v0.1.1-0.20211011073646-a38034248e90
6+
github.com/go-rel/rel v0.25.1-0.20211012061337-dfb3d0951876
7+
github.com/go-rel/sql v0.1.1-0.20211012072023-36066d80a50a
88
github.com/lib/pq v1.10.3
99
github.com/stretchr/testify v1.7.0
1010
)

go.sum

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
44
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
55
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
66
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
7-
github.com/go-rel/rel v0.25.1-0.20211007095335-eec7ac68c920/go.mod h1:/VBLj1U4ZVb53aB3n22RQwX0V9DvckohseDJQibn2Rs=
8-
github.com/go-rel/rel v0.25.1-0.20211011102656-a1b38f01d34a h1:FAd8FrXgy+G/44OwXYOk3A0b4lhdoyKMgF9m3h6pTt4=
9-
github.com/go-rel/rel v0.25.1-0.20211011102656-a1b38f01d34a/go.mod h1:/VBLj1U4ZVb53aB3n22RQwX0V9DvckohseDJQibn2Rs=
10-
github.com/go-rel/sql v0.1.1-0.20211011073646-a38034248e90 h1:638QwWIymw8cizASdq594qlDM729vYEtJobdy8wv2Lo=
11-
github.com/go-rel/sql v0.1.1-0.20211011073646-a38034248e90/go.mod h1:ukXvTr/zbEZLu+lJCXcKpMg1Vp7Ps9cfKD+Us4kJREo=
7+
github.com/go-rel/rel v0.25.1-0.20211012061337-dfb3d0951876 h1:NAVlxoe5yAmCXKqgwBW2eUuc44zqJaY42v7ldSqxzf8=
8+
github.com/go-rel/rel v0.25.1-0.20211012061337-dfb3d0951876/go.mod h1:/VBLj1U4ZVb53aB3n22RQwX0V9DvckohseDJQibn2Rs=
9+
github.com/go-rel/sql v0.1.1-0.20211012072023-36066d80a50a h1:hyaIbbU0uuitQ6oAH6KHjRaxTUsjUDqVEe32qeGP6aw=
10+
github.com/go-rel/sql v0.1.1-0.20211012072023-36066d80a50a/go.mod h1:M6VxbYbMCeRR50h70wIL6zCw1Ui5x+6plAHyuhnrCLg=
1211
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
1312
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
1413
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=

postgres.go

+2
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ func columnMapper(column *rel.Column) (string, int, int) {
168168
case rel.Int, rel.BigInt, rel.Text:
169169
column.Limit = 0
170170
typ, m, n = sql.ColumnMapper(column)
171+
case rel.JSON:
172+
typ = "JSONB"
171173
default:
172174
typ, m, n = sql.ColumnMapper(column)
173175
}

0 commit comments

Comments
 (0)