[chore] Update bun and sqlite dependencies (#478)

* update bun + sqlite versions

* step bun to v1.1.3
This commit is contained in:
tobi 2022-04-24 12:26:22 +02:00 committed by GitHub
commit 88979b35d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
246 changed files with 409690 additions and 148967 deletions

View file

@ -10,6 +10,7 @@ import (
type Field struct {
StructField reflect.StructField
IsPtr bool
Tag tagparser.Tag
IndirectType reflect.Type
@ -51,15 +52,36 @@ func (f *Field) Value(strct reflect.Value) reflect.Value {
return fieldByIndexAlloc(strct, f.Index)
}
func (f *Field) HasZeroValue(v reflect.Value) bool {
for _, idx := range f.Index {
func (f *Field) HasNilValue(v reflect.Value) bool {
if len(f.Index) == 1 {
return v.Field(f.Index[0]).IsNil()
}
for _, index := range f.Index {
if v.Kind() == reflect.Ptr {
if v.IsNil() {
return true
}
v = v.Elem()
}
v = v.Field(idx)
v = v.Field(index)
}
return v.IsNil()
}
func (f *Field) HasZeroValue(v reflect.Value) bool {
if len(f.Index) == 1 {
return f.IsZero(v.Field(f.Index[0]))
}
for _, index := range f.Index {
if v.Kind() == reflect.Ptr {
if v.IsNil() {
return true
}
v = v.Elem()
}
v = v.Field(index)
}
return f.IsZero(v)
}
@ -70,7 +92,7 @@ func (f *Field) AppendValue(fmter Formatter, b []byte, strct reflect.Value) []by
return dialect.AppendNull(b)
}
if f.NullZero && f.IsZero(fv) {
if (f.IsPtr && fv.IsNil()) || (f.NullZero && f.IsZero(fv)) {
return dialect.AppendNull(b)
}
if f.Append == nil {
@ -98,14 +120,6 @@ func (f *Field) ScanValue(strct reflect.Value, src interface{}) error {
return f.ScanWithCheck(fv, src)
}
func (f *Field) markAsPK() {
f.IsPK = true
f.NotNull = true
if !f.Tag.HasOption("allowzero") {
f.NullZero = true
}
}
func indexEqual(ind1, ind2 []int) bool {
if len(ind1) != len(ind2) {
return false