Skip to content

Commit 9b32a5a

Browse files
committed
Merge remote-tracking branch 'upstream/master'
Signed-off-by: Kyle McCullough <[email protected]>
2 parents 631d6fd + b0fb54c commit 9b32a5a

File tree

117 files changed

+2127
-1321
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+2127
-1321
lines changed

CHANGELOG.md

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,51 @@
1+
## [1.2.5](https://github.com/uptrace/bun/compare/v1.2.3...v1.2.5) (2024-10-26)
2+
3+
4+
### Bug Fixes
5+
6+
* allow Limit() without Order() with MSSQL ([#1009](https://github.com/uptrace/bun/issues/1009)) ([1a46ddc](https://github.com/uptrace/bun/commit/1a46ddc0d3ca0bdc60ca8be5ad1886799d14c8b0))
7+
* copy bytes in mapModel.Scan ([#1030](https://github.com/uptrace/bun/issues/1030)) ([#1032](https://github.com/uptrace/bun/issues/1032)) ([39fda4e](https://github.com/uptrace/bun/commit/39fda4e3d341e59e4955f751cb354a939e57c1b1))
8+
* fix issue with has-many join and pointer fields ([#950](https://github.com/uptrace/bun/issues/950)) ([#983](https://github.com/uptrace/bun/issues/983)) ([cbc5177](https://github.com/uptrace/bun/commit/cbc517792ba6cdcef1828f3699d3d4dfe3c5e0eb))
9+
* restore explicit column: name override ([#984](https://github.com/uptrace/bun/issues/984)) ([169f258](https://github.com/uptrace/bun/commit/169f258a9460cad451f3025d2ef8df1bbd42a003))
10+
* return column option back ([#1036](https://github.com/uptrace/bun/issues/1036)) ([a3ccbea](https://github.com/uptrace/bun/commit/a3ccbeab39151d3eed6cb245fe15cfb5d71ba557))
11+
* sql.NullString mistaken as custom struct ([#1019](https://github.com/uptrace/bun/issues/1019)) ([87c77b8](https://github.com/uptrace/bun/commit/87c77b8911f2035b0ee8ea96356a2c7600b5b94d))
12+
* typos ([#1026](https://github.com/uptrace/bun/issues/1026)) ([760de7d](https://github.com/uptrace/bun/commit/760de7d0fad15dc761475670a4dde056aef9210d))
13+
14+
15+
### Features
16+
17+
* add transaction isolation level support to pgdriver ([#1034](https://github.com/uptrace/bun/issues/1034)) ([3ef44ce](https://github.com/uptrace/bun/commit/3ef44ce1cdd969a21b76d6c803119cf12c375cb0))
18+
19+
20+
### Performance Improvements
21+
22+
* refactor SelectQuery.ScanAndCount to optimize performance when there is no limit and offset ([#1035](https://github.com/uptrace/bun/issues/1035)) ([8638613](https://github.com/uptrace/bun/commit/86386135897485bbada6c50ec9a2743626111433))
23+
24+
25+
26+
## [1.2.4](https://github.com/uptrace/bun/compare/v1.2.3...v1.2.4) (2024-10-26)
27+
28+
29+
### Bug Fixes
30+
31+
* allow Limit() without Order() with MSSQL ([#1009](https://github.com/uptrace/bun/issues/1009)) ([1a46ddc](https://github.com/uptrace/bun/commit/1a46ddc0d3ca0bdc60ca8be5ad1886799d14c8b0))
32+
* copy bytes in mapModel.Scan ([#1030](https://github.com/uptrace/bun/issues/1030)) ([#1032](https://github.com/uptrace/bun/issues/1032)) ([39fda4e](https://github.com/uptrace/bun/commit/39fda4e3d341e59e4955f751cb354a939e57c1b1))
33+
* return column option back ([#1036](https://github.com/uptrace/bun/issues/1036)) ([a3ccbea](https://github.com/uptrace/bun/commit/a3ccbeab39151d3eed6cb245fe15cfb5d71ba557))
34+
* sql.NullString mistaken as custom struct ([#1019](https://github.com/uptrace/bun/issues/1019)) ([87c77b8](https://github.com/uptrace/bun/commit/87c77b8911f2035b0ee8ea96356a2c7600b5b94d))
35+
* typos ([#1026](https://github.com/uptrace/bun/issues/1026)) ([760de7d](https://github.com/uptrace/bun/commit/760de7d0fad15dc761475670a4dde056aef9210d))
36+
37+
38+
### Features
39+
40+
* add transaction isolation level support to pgdriver ([#1034](https://github.com/uptrace/bun/issues/1034)) ([3ef44ce](https://github.com/uptrace/bun/commit/3ef44ce1cdd969a21b76d6c803119cf12c375cb0))
41+
42+
43+
### Performance Improvements
44+
45+
* refactor SelectQuery.ScanAndCount to optimize performance when there is no limit and offset ([#1035](https://github.com/uptrace/bun/issues/1035)) ([8638613](https://github.com/uptrace/bun/commit/86386135897485bbada6c50ec9a2743626111433))
46+
47+
48+
149
## [1.2.3](https://github.com/uptrace/bun/compare/v1.2.2...v1.2.3) (2024-08-31)
250

351

@@ -33,7 +81,7 @@
3381

3482
### Features
3583

36-
* Allow overiding of Warn and Deprecated loggers ([#952](https://github.com/uptrace/bun/issues/952)) ([0e9d737](https://github.com/uptrace/bun/commit/0e9d737e4ca2deb86930237ee32a39cf3f7e8157))
84+
* Allow overriding of Warn and Deprecated loggers ([#952](https://github.com/uptrace/bun/issues/952)) ([0e9d737](https://github.com/uptrace/bun/commit/0e9d737e4ca2deb86930237ee32a39cf3f7e8157))
3785
* enable SNI ([#953](https://github.com/uptrace/bun/issues/953)) ([4071ffb](https://github.com/uptrace/bun/commit/4071ffb5bcb1b233cda239c92504d8139dcf1d2f))
3886
* **idb:** add NewMerge method to IDB ([#966](https://github.com/uptrace/bun/issues/966)) ([664e2f1](https://github.com/uptrace/bun/commit/664e2f154f1153d2a80cd062a5074f1692edaee7))
3987

@@ -119,7 +167,7 @@
119167

120168
### Bug Fixes
121169

122-
* add support for inserting values with unicode encoding for mssql dialect ([e98c6c0](https://github.com/uptrace/bun/commit/e98c6c0f033b553bea3bbc783aa56c2eaa17718f))
170+
* add support for inserting values with Unicode encoding for mssql dialect ([e98c6c0](https://github.com/uptrace/bun/commit/e98c6c0f033b553bea3bbc783aa56c2eaa17718f))
123171
* fix relation tag ([a3eedff](https://github.com/uptrace/bun/commit/a3eedff49700490d4998dcdcdc04f554d8f17166))
124172

125173

@@ -155,7 +203,7 @@
155203

156204
### Bug Fixes
157205

158-
* addng dialect override for append-bool ([#695](https://github.com/uptrace/bun/issues/695)) ([338f2f0](https://github.com/uptrace/bun/commit/338f2f04105ad89e64530db86aeb387e2ad4789e))
206+
* adding dialect override for append-bool ([#695](https://github.com/uptrace/bun/issues/695)) ([338f2f0](https://github.com/uptrace/bun/commit/338f2f04105ad89e64530db86aeb387e2ad4789e))
159207
* don't call hooks twice for whereExists ([9057857](https://github.com/uptrace/bun/commit/90578578e717f248e4b6eb114c5b495fd8d4ed41))
160208
* don't lock migrations when running Migrate and Rollback ([69a7354](https://github.com/uptrace/bun/commit/69a7354d987ff2ed5338c9ef5f4ce320724299ab))
161209
* **query:** make WhereDeleted compatible with ForceDelete ([299c3fd](https://github.com/uptrace/bun/commit/299c3fd57866aaecd127a8f219c95332898475db)), closes [#673](https://github.com/uptrace/bun/issues/673)
@@ -323,7 +371,7 @@ recommended to upgrade to v1.0.24 before upgrading to v1.1.x.
323371

324372
- append slice values
325373
([4a65129](https://github.com/uptrace/bun/commit/4a651294fb0f1e73079553024810c3ead9777311))
326-
- check for nils when appeding driver.Value
374+
- check for nils when appending driver.Value
327375
([7bb1640](https://github.com/uptrace/bun/commit/7bb1640a00fceca1e1075fe6544b9a4842ab2b26))
328376
- cleanup soft deletes for mssql
329377
([e72e2c5](https://github.com/uptrace/bun/commit/e72e2c5d0a85f3d26c3fa22c7284c2de1dcfda8e))
@@ -342,7 +390,7 @@ recommended to upgrade to v1.0.24 before upgrading to v1.1.x.
342390

343391
### Deprecated
344392

345-
In the comming v1.1.x release, Bun will stop automatically adding `,pk,autoincrement` options on
393+
In the coming v1.1.x release, Bun will stop automatically adding `,pk,autoincrement` options on
346394
`ID int64/int32` fields. This version (v1.0.23) only prints a warning when it encounters such
347395
fields, but the code will continue working as before.
348396

@@ -460,7 +508,7 @@ In v1.1.x, such options as `,nopk` and `,allowzero` will not be necessary and wi
460508
([693f1e1](https://github.com/uptrace/bun/commit/693f1e135999fc31cf83b99a2530a695b20f4e1b))
461509
- add model embedding via embed:prefix\_
462510
([9a2cedc](https://github.com/uptrace/bun/commit/9a2cedc8b08fa8585d4bfced338bd0a40d736b1d))
463-
- change the default logoutput to stderr
511+
- change the default log output to stderr
464512
([4bf5773](https://github.com/uptrace/bun/commit/4bf577382f19c64457cbf0d64490401450954654)),
465513
closes [#349](https://github.com/uptrace/bun/issues/349)
466514

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SQL-first Golang ORM for PostgreSQL, MySQL, MSSQL, and SQLite
1+
# SQL-first Golang ORM for PostgreSQL, MySQL, MSSQL, SQLite and Oracle
22

33
[![build workflow](https://github.com/uptrace/bun/actions/workflows/build.yml/badge.svg)](https://github.com/uptrace/bun/actions)
44
[![PkgGoDev](https://pkg.go.dev/badge/github.com/uptrace/bun)](https://pkg.go.dev/github.com/uptrace/bun)
@@ -19,6 +19,7 @@
1919
[MySQL](https://bun.uptrace.dev/guide/drivers.html#mysql) (including MariaDB),
2020
[MSSQL](https://bun.uptrace.dev/guide/drivers.html#mssql),
2121
[SQLite](https://bun.uptrace.dev/guide/drivers.html#sqlite).
22+
[Oracle](https://bun.uptrace.dev/guide/drivers.html#oracle).
2223
- [ORM-like](/example/basic/) experience using good old SQL. Bun supports structs, map, scalars, and
2324
slices of map/structs/scalars.
2425
- [Bulk inserts](https://bun.uptrace.dev/guide/query-insert.html).

bun.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ type AfterDropTableHook interface {
7474
AfterDropTable(ctx context.Context, query *DropTableQuery) error
7575
}
7676

77-
// SetLogger overwriters default Bun logger.
77+
// SetLogger overwrites default Bun logger.
7878
func SetLogger(logger internal.Logging) {
7979
internal.SetLogger(logger)
8080
}

dbfixture/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.22
55
replace github.com/uptrace/bun => ../
66

77
require (
8-
github.com/uptrace/bun v1.2.3
8+
github.com/uptrace/bun v1.2.5
99
gopkg.in/yaml.v3 v3.0.1
1010
)
1111

@@ -16,5 +16,5 @@ require (
1616
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
1717
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
1818
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
19-
golang.org/x/sys v0.25.0 // indirect
19+
golang.org/x/sys v0.26.0 // indirect
2020
)

dbfixture/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IU
1919
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
2020
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
2121
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
22-
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
23-
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
22+
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
23+
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
2424
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
2525
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
2626
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

dialect/dialect.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ func (n Name) String() string {
1212
return "mysql"
1313
case MSSQL:
1414
return "mssql"
15+
case Oracle:
16+
return "oracle"
1517
default:
1618
return "invalid"
1719
}
@@ -23,4 +25,5 @@ const (
2325
SQLite
2426
MySQL
2527
MSSQL
28+
Oracle
2629
)

dialect/mssqldialect/dialect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func (*Dialect) AppendBool(b []byte, v bool) []byte {
128128
}
129129

130130
func (d *Dialect) AppendString(b []byte, s string) []byte {
131-
// 'N' prefix means the string uses unicode encoding.
131+
// 'N' prefix means the string uses Unicode encoding.
132132
b = append(b, 'N')
133133
return d.BaseDialect.AppendString(b, s)
134134
}

dialect/mssqldialect/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ toolchain go1.22.6
77
replace github.com/uptrace/bun => ../..
88

99
require (
10-
github.com/uptrace/bun v1.2.3
10+
github.com/uptrace/bun v1.2.5
1111
golang.org/x/mod v0.21.0
1212
)
1313

@@ -17,5 +17,5 @@ require (
1717
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
1818
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
1919
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
20-
golang.org/x/sys v0.25.0 // indirect
20+
golang.org/x/sys v0.26.0 // indirect
2121
)

dialect/mssqldialect/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAh
1616
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
1717
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
1818
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
19-
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
20-
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
19+
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
20+
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
2121
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
2222
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

dialect/mssqldialect/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ package mssqldialect
22

33
// Version is the current release version.
44
func Version() string {
5-
return "1.2.3"
5+
return "1.2.5"
66
}

dialect/mysqldialect/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ toolchain go1.22.6
77
replace github.com/uptrace/bun => ../..
88

99
require (
10-
github.com/uptrace/bun v1.2.3
10+
github.com/uptrace/bun v1.2.5
1111
golang.org/x/mod v0.21.0
1212
)
1313

@@ -17,5 +17,5 @@ require (
1717
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
1818
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
1919
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
20-
golang.org/x/sys v0.25.0 // indirect
20+
golang.org/x/sys v0.26.0 // indirect
2121
)

dialect/mysqldialect/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAh
1616
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
1717
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
1818
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
19-
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
20-
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
19+
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
20+
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
2121
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
2222
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

dialect/mysqldialect/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ package mysqldialect
22

33
// Version is the current release version.
44
func Version() string {
5-
return "1.2.3"
5+
return "1.2.5"
66
}

dialect/oracledialect/dialect.go

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
package oracledialect
2+
3+
import (
4+
"database/sql"
5+
"encoding/hex"
6+
"fmt"
7+
"time"
8+
9+
"github.com/uptrace/bun"
10+
"github.com/uptrace/bun/dialect"
11+
"github.com/uptrace/bun/dialect/feature"
12+
"github.com/uptrace/bun/dialect/sqltype"
13+
"github.com/uptrace/bun/schema"
14+
)
15+
16+
func init() {
17+
if Version() != bun.Version() {
18+
panic(fmt.Errorf("oracledialect and Bun must have the same version: v%s != v%s",
19+
Version(), bun.Version()))
20+
}
21+
}
22+
23+
type Dialect struct {
24+
schema.BaseDialect
25+
26+
tables *schema.Tables
27+
features feature.Feature
28+
}
29+
30+
func New() *Dialect {
31+
d := new(Dialect)
32+
d.tables = schema.NewTables(d)
33+
d.features = feature.CTE |
34+
feature.WithValues |
35+
feature.Returning |
36+
//feature.InsertReturning | // TODO
37+
//feature.Output | // TODO
38+
feature.InsertOnConflict |
39+
//feature.TableNotExists |
40+
feature.SelectExists |
41+
feature.AutoIncrement |
42+
feature.CompositeIn
43+
return d
44+
}
45+
46+
func (d *Dialect) Init(*sql.DB) {}
47+
48+
func (d *Dialect) Name() dialect.Name {
49+
return dialect.Oracle
50+
}
51+
52+
func (d *Dialect) Features() feature.Feature {
53+
return d.features
54+
}
55+
56+
func (d *Dialect) Tables() *schema.Tables {
57+
return d.tables
58+
}
59+
60+
func (d *Dialect) OnTable(table *schema.Table) {
61+
for _, field := range table.FieldMap {
62+
d.onField(field)
63+
}
64+
}
65+
66+
func (d *Dialect) onField(field *schema.Field) {
67+
field.DiscoveredSQLType = fieldSQLType(field)
68+
}
69+
70+
func (d *Dialect) IdentQuote() byte {
71+
return '"'
72+
}
73+
74+
func (*Dialect) AppendBytes(b, bs []byte) []byte {
75+
if bs == nil {
76+
return dialect.AppendNull(b)
77+
}
78+
79+
b = append(b, "0x"...)
80+
81+
s := len(b)
82+
b = append(b, make([]byte, hex.EncodedLen(len(bs)))...)
83+
hex.Encode(b[s:], bs)
84+
85+
return b
86+
}
87+
88+
func (d *Dialect) DefaultVarcharLen() int {
89+
return 255
90+
}
91+
92+
func (d *Dialect) AppendSequence(b []byte, table *schema.Table, field *schema.Field) []byte {
93+
return append(b, " GENERATED BY DEFAULT AS IDENTITY"...)
94+
}
95+
96+
func fieldSQLType(field *schema.Field) string {
97+
switch field.DiscoveredSQLType {
98+
case sqltype.SmallInt, sqltype.BigInt:
99+
// INTEGER PRIMARY KEY is an alias for the ROWID.
100+
// It is safe to convert all ints to INTEGER, because SQLite types don't have size.
101+
return sqltype.Integer
102+
case sqltype.Boolean:
103+
return "number(1,0)"
104+
default:
105+
return field.DiscoveredSQLType
106+
}
107+
}
108+
109+
func (*Dialect) AppendTime(b []byte, tm time.Time) []byte {
110+
if tm.IsZero() {
111+
b = append(b, "NULL"...)
112+
return b
113+
}
114+
b = append(b, "TO_TIMESTAMP('"...)
115+
b = tm.AppendFormat(b, "2006-01-02 15:04:05.999999")
116+
b = append(b, "', 'YYYY-MM-DD HH24:MI:SS.FF')"...)
117+
return b
118+
}
119+
120+
func (*Dialect) AppendBool(b []byte, v bool) []byte {
121+
if v {
122+
return append(b, '1')
123+
}
124+
125+
return append(b, '0')
126+
}

dialect/oracledialect/version.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package oracledialect
2+
3+
// Version is the current release version.
4+
func Version() string {
5+
return "1.2.1"
6+
}

dialect/pgdialect/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ replace github.com/uptrace/bun => ../..
66

77
require (
88
github.com/stretchr/testify v1.8.1
9-
github.com/uptrace/bun v1.2.3
9+
github.com/uptrace/bun v1.2.5
1010
)
1111

1212
require (
@@ -18,6 +18,6 @@ require (
1818
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
1919
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
2020
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
21-
golang.org/x/sys v0.25.0 // indirect
21+
golang.org/x/sys v0.26.0 // indirect
2222
gopkg.in/yaml.v3 v3.0.1 // indirect
2323
)

0 commit comments

Comments
 (0)