mirror of
1
Fork 0

update bun library to latest commit (#206)

* update bun library to latest commit

Signed-off-by: kim (grufwub) <grufwub@gmail.com>

* update to latest bun release

Signed-off-by: kim (grufwub) <grufwub@gmail.com>
This commit is contained in:
kim 2021-09-11 12:53:44 +01:00 committed by GitHub
parent fc035868b2
commit bac4ee9980
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 39 additions and 15 deletions

2
go.mod
View File

@ -27,7 +27,7 @@ require (
github.com/superseriousbusiness/exifremove v0.0.0-20210330092427-6acd27eac203 github.com/superseriousbusiness/exifremove v0.0.0-20210330092427-6acd27eac203
github.com/superseriousbusiness/oauth2/v4 v4.3.2-SSB github.com/superseriousbusiness/oauth2/v4 v4.3.2-SSB
github.com/tdewolff/minify/v2 v2.9.21 github.com/tdewolff/minify/v2 v2.9.21
github.com/uptrace/bun v1.0.5 github.com/uptrace/bun v1.0.6
github.com/uptrace/bun/dialect/pgdialect v1.0.5 github.com/uptrace/bun/dialect/pgdialect v1.0.5
github.com/uptrace/bun/dialect/sqlitedialect v1.0.5 github.com/uptrace/bun/dialect/sqlitedialect v1.0.5
github.com/urfave/cli/v2 v2.3.0 github.com/urfave/cli/v2 v2.3.0

3
go.sum
View File

@ -450,8 +450,9 @@ github.com/ugorji/go v1.2.6/go.mod h1:anCg0y61KIhDlPZmnH+so+RQbysYVyDko0IMgJv0Nn
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/ugorji/go/codec v1.2.6 h1:7kbGefxLoDBuYXOms4yD7223OpNMMPNPZxXk5TvFcyQ= github.com/ugorji/go/codec v1.2.6 h1:7kbGefxLoDBuYXOms4yD7223OpNMMPNPZxXk5TvFcyQ=
github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxWFFpvxTw= github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxWFFpvxTw=
github.com/uptrace/bun v1.0.5 h1:bNhNhWt6XNwSWMEQUvYK7iJ3qHrMfeoKY3/w2jkqcBs=
github.com/uptrace/bun v1.0.5/go.mod h1:aL6D9vPw8DXaTQTwGrEPtUderBYXx7ShUmPfnxnqscw= github.com/uptrace/bun v1.0.5/go.mod h1:aL6D9vPw8DXaTQTwGrEPtUderBYXx7ShUmPfnxnqscw=
github.com/uptrace/bun v1.0.6 h1:o9eMq5ePGBXtxbK3SIreOCRr+rIBQzvJH+/s98kYcVM=
github.com/uptrace/bun v1.0.6/go.mod h1:aL6D9vPw8DXaTQTwGrEPtUderBYXx7ShUmPfnxnqscw=
github.com/uptrace/bun/dialect/pgdialect v1.0.5 h1:mq694/aMvs7GwuTar9NIlCLQt/2u4xsF0QMP4I24yHA= github.com/uptrace/bun/dialect/pgdialect v1.0.5 h1:mq694/aMvs7GwuTar9NIlCLQt/2u4xsF0QMP4I24yHA=
github.com/uptrace/bun/dialect/pgdialect v1.0.5/go.mod h1:MKWjO0PC20ris2oJ3dd6mI/762x24Cjwh8XmbqUhM8A= github.com/uptrace/bun/dialect/pgdialect v1.0.5/go.mod h1:MKWjO0PC20ris2oJ3dd6mI/762x24Cjwh8XmbqUhM8A=
github.com/uptrace/bun/dialect/sqlitedialect v1.0.5 h1:6cIj31YVJr4vvA15C2v76soXL+7WtjFdV6WraApc3r0= github.com/uptrace/bun/dialect/sqlitedialect v1.0.5 h1:6cIj31YVJr4vvA15C2v76soXL+7WtjFdV6WraApc3r0=

View File

@ -1,4 +1,12 @@
# Changelog ## [1.0.6](https://github.com/uptrace/bun/compare/v1.0.5...v1.0.6) (2021-09-11)
### Bug Fixes
* change unique tag to create a separate unique constraint ([8401615](https://github.com/uptrace/bun/commit/84016155a77ca77613cc054277fefadae3098757))
* improve zero checker for ptr values ([2b3623d](https://github.com/uptrace/bun/commit/2b3623dd665d873911fd20ca707016929921e862))
## v1.0.5 - Sep 09 2021 ## v1.0.5 - Sep 09 2021

1
vendor/github.com/uptrace/bun/commitlint.config.js generated vendored Normal file
View File

@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] }

8
vendor/github.com/uptrace/bun/package.json generated vendored Normal file
View File

@ -0,0 +1,8 @@
{
"name": "bun",
"version": "1.0.6",
"main": "index.js",
"repository": "git@github.com:uptrace/bun.git",
"author": "Vladimir Mihailenco <vladimir.webdev@gmail.com>",
"license": "BSD-2-clause"
}

View File

@ -186,14 +186,20 @@ func (q *CreateTableQuery) appendUniqueConstraints(fmter schema.Formatter, b []b
sort.Strings(keys) sort.Strings(keys)
for _, key := range keys { for _, key := range keys {
b = q.appendUniqueConstraint(fmter, b, key, unique[key]) if key == "" {
for _, field := range unique[key] {
b = q.appendUniqueConstraint(fmter, b, key, field)
}
continue
}
b = q.appendUniqueConstraint(fmter, b, key, unique[key]...)
} }
return b return b
} }
func (q *CreateTableQuery) appendUniqueConstraint( func (q *CreateTableQuery) appendUniqueConstraint(
fmter schema.Formatter, b []byte, name string, fields []*schema.Field, fmter schema.Formatter, b []byte, name string, fields ...*schema.Field,
) []byte { ) []byte {
if name != "" { if name != "" {
b = append(b, ", CONSTRAINT "...) b = append(b, ", CONSTRAINT "...)
@ -204,7 +210,6 @@ func (q *CreateTableQuery) appendUniqueConstraint(
b = append(b, " UNIQUE ("...) b = append(b, " UNIQUE ("...)
b = appendColumns(b, "", fields) b = appendColumns(b, "", fields)
b = append(b, ")"...) b = append(b, ")"...)
return b return b
} }

View File

@ -193,10 +193,15 @@ func (t *Table) initFields() {
} }
} }
if len(t.PKs) == 1 { if len(t.PKs) == 1 {
switch t.PKs[0].IndirectType.Kind() { pk := t.PKs[0]
if pk.SQLDefault != "" {
return
}
switch pk.IndirectType.Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
t.PKs[0].AutoIncrement = true pk.AutoIncrement = true
} }
} }
} }
@ -359,7 +364,7 @@ func (t *Table) newField(f reflect.StructField, index []int) *Field {
field.DiscoveredSQLType = DiscoverSQLType(field.IndirectType) field.DiscoveredSQLType = DiscoverSQLType(field.IndirectType)
field.Append = t.dialect.FieldAppender(field) field.Append = t.dialect.FieldAppender(field)
field.Scan = FieldScanner(t.dialect, field) field.Scan = FieldScanner(t.dialect, field)
field.IsZero = FieldZeroChecker(field) field.IsZero = zeroChecker(field.StructField.Type)
if v, ok := tag.Options["alt"]; ok { if v, ok := tag.Options["alt"]; ok {
t.FieldMap[v] = field t.FieldMap[v] = field

View File

@ -13,10 +13,6 @@ type isZeroer interface {
type IsZeroerFunc func(reflect.Value) bool type IsZeroerFunc func(reflect.Value) bool
func FieldZeroChecker(field *Field) IsZeroerFunc {
return zeroChecker(field.IndirectType)
}
func zeroChecker(typ reflect.Type) IsZeroerFunc { func zeroChecker(typ reflect.Type) IsZeroerFunc {
if typ.Implements(isZeroerType) { if typ.Implements(isZeroerType) {
return isZeroInterface return isZeroInterface

View File

@ -2,5 +2,5 @@ package bun
// Version is the current release version. // Version is the current release version.
func Version() string { func Version() string {
return "1.0.5" return "1.0.6"
} }

2
vendor/modules.txt vendored
View File

@ -418,7 +418,7 @@ github.com/tmthrgd/go-hex
# github.com/ugorji/go/codec v1.2.6 # github.com/ugorji/go/codec v1.2.6
## explicit; go 1.11 ## explicit; go 1.11
github.com/ugorji/go/codec github.com/ugorji/go/codec
# github.com/uptrace/bun v1.0.5 # github.com/uptrace/bun v1.0.6
## explicit; go 1.16 ## explicit; go 1.16
github.com/uptrace/bun github.com/uptrace/bun
github.com/uptrace/bun/dialect github.com/uptrace/bun/dialect