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
10 changed files with 39 additions and 15 deletions

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

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)
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
}
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 {
if name != "" {
b = append(b, ", CONSTRAINT "...)
@ -204,7 +210,6 @@ func (q *CreateTableQuery) appendUniqueConstraint(
b = append(b, " UNIQUE ("...)
b = appendColumns(b, "", fields)
b = append(b, ")"...)
return b
}

View File

@ -193,10 +193,15 @@ func (t *Table) initFields() {
}
}
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,
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.Append = t.dialect.FieldAppender(field)
field.Scan = FieldScanner(t.dialect, field)
field.IsZero = FieldZeroChecker(field)
field.IsZero = zeroChecker(field.StructField.Type)
if v, ok := tag.Options["alt"]; ok {
t.FieldMap[v] = field

View File

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

View File

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