summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/dialect
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/uptrace/bun/dialect')
-rw-r--r--vendor/github.com/uptrace/bun/dialect/append.go88
-rw-r--r--vendor/github.com/uptrace/bun/dialect/dialect.go26
-rw-r--r--vendor/github.com/uptrace/bun/dialect/feature/feature.go34
-rw-r--r--vendor/github.com/uptrace/bun/dialect/pgdialect/LICENSE24
-rw-r--r--vendor/github.com/uptrace/bun/dialect/pgdialect/append.go364
-rw-r--r--vendor/github.com/uptrace/bun/dialect/pgdialect/array.go65
-rw-r--r--vendor/github.com/uptrace/bun/dialect/pgdialect/array_parser.go133
-rw-r--r--vendor/github.com/uptrace/bun/dialect/pgdialect/array_scan.go302
-rw-r--r--vendor/github.com/uptrace/bun/dialect/pgdialect/dialect.go109
-rw-r--r--vendor/github.com/uptrace/bun/dialect/pgdialect/hstore.go73
-rw-r--r--vendor/github.com/uptrace/bun/dialect/pgdialect/hstore_parser.go142
-rw-r--r--vendor/github.com/uptrace/bun/dialect/pgdialect/hstore_scan.go82
-rw-r--r--vendor/github.com/uptrace/bun/dialect/pgdialect/safe.go11
-rw-r--r--vendor/github.com/uptrace/bun/dialect/pgdialect/scan.go11
-rw-r--r--vendor/github.com/uptrace/bun/dialect/pgdialect/sqltype.go105
-rw-r--r--vendor/github.com/uptrace/bun/dialect/pgdialect/stream_parser.go60
-rw-r--r--vendor/github.com/uptrace/bun/dialect/pgdialect/unsafe.go18
-rw-r--r--vendor/github.com/uptrace/bun/dialect/pgdialect/version.go6
-rw-r--r--vendor/github.com/uptrace/bun/dialect/sqlitedialect/LICENSE24
-rw-r--r--vendor/github.com/uptrace/bun/dialect/sqlitedialect/dialect.go98
-rw-r--r--vendor/github.com/uptrace/bun/dialect/sqlitedialect/scan.go11
-rw-r--r--vendor/github.com/uptrace/bun/dialect/sqlitedialect/version.go6
-rw-r--r--vendor/github.com/uptrace/bun/dialect/sqltype/sqltype.go16
23 files changed, 0 insertions, 1808 deletions
diff --git a/vendor/github.com/uptrace/bun/dialect/append.go b/vendor/github.com/uptrace/bun/dialect/append.go
deleted file mode 100644
index 0a25ee22d..000000000
--- a/vendor/github.com/uptrace/bun/dialect/append.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package dialect
-
-import (
- "math"
- "strconv"
-
- "github.com/uptrace/bun/internal"
-)
-
-func AppendError(b []byte, err error) []byte {
- b = append(b, "?!("...)
- b = append(b, err.Error()...)
- b = append(b, ')')
- return b
-}
-
-func AppendNull(b []byte) []byte {
- return append(b, "NULL"...)
-}
-
-func AppendBool(b []byte, v bool) []byte {
- if v {
- return append(b, "TRUE"...)
- }
- return append(b, "FALSE"...)
-}
-
-func AppendFloat32(b []byte, v float32) []byte {
- return appendFloat(b, float64(v), 32)
-}
-
-func AppendFloat64(b []byte, v float64) []byte {
- return appendFloat(b, v, 64)
-}
-
-func appendFloat(b []byte, v float64, bitSize int) []byte {
- switch {
- case math.IsNaN(v):
- return append(b, "'NaN'"...)
- case math.IsInf(v, 1):
- return append(b, "'Infinity'"...)
- case math.IsInf(v, -1):
- return append(b, "'-Infinity'"...)
- default:
- return strconv.AppendFloat(b, v, 'f', -1, bitSize)
- }
-}
-
-//------------------------------------------------------------------------------
-
-func AppendIdent(b []byte, field string, quote byte) []byte {
- return appendIdent(b, internal.Bytes(field), quote)
-}
-
-func appendIdent(b, src []byte, quote byte) []byte {
- var quoted bool
-loop:
- for _, c := range src {
- switch c {
- case '*':
- if !quoted {
- b = append(b, '*')
- continue loop
- }
- case '.':
- if quoted {
- b = append(b, quote)
- quoted = false
- }
- b = append(b, '.')
- continue loop
- }
-
- if !quoted {
- b = append(b, quote)
- quoted = true
- }
- if c == quote {
- b = append(b, quote, quote)
- } else {
- b = append(b, c)
- }
- }
- if quoted {
- b = append(b, quote)
- }
- return b
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/dialect.go b/vendor/github.com/uptrace/bun/dialect/dialect.go
deleted file mode 100644
index 03b81fbbc..000000000
--- a/vendor/github.com/uptrace/bun/dialect/dialect.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package dialect
-
-type Name int
-
-func (n Name) String() string {
- switch n {
- case PG:
- return "pg"
- case SQLite:
- return "sqlite"
- case MySQL:
- return "mysql"
- case MSSQL:
- return "mssql"
- default:
- return "invalid"
- }
-}
-
-const (
- Invalid Name = iota
- PG
- SQLite
- MySQL
- MSSQL
-)
diff --git a/vendor/github.com/uptrace/bun/dialect/feature/feature.go b/vendor/github.com/uptrace/bun/dialect/feature/feature.go
deleted file mode 100644
index 956dc4985..000000000
--- a/vendor/github.com/uptrace/bun/dialect/feature/feature.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package feature
-
-import "github.com/uptrace/bun/internal"
-
-type Feature = internal.Flag
-
-const (
- CTE Feature = 1 << iota
- WithValues
- Returning
- InsertReturning
- Output // mssql
- DefaultPlaceholder
- DoubleColonCast
- ValuesRow
- UpdateMultiTable
- InsertTableAlias
- UpdateTableAlias
- DeleteTableAlias
- AutoIncrement
- Identity
- TableCascade
- TableIdentity
- TableTruncate
- InsertOnConflict // INSERT ... ON CONFLICT
- InsertOnDuplicateKey // INSERT ... ON DUPLICATE KEY
- InsertIgnore // INSERT IGNORE ...
- TableNotExists
- OffsetFetch
- SelectExists
- UpdateFromTable
- MSSavepoint
- GeneratedIdentity
-)
diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/LICENSE b/vendor/github.com/uptrace/bun/dialect/pgdialect/LICENSE
deleted file mode 100644
index 7ec81810c..000000000
--- a/vendor/github.com/uptrace/bun/dialect/pgdialect/LICENSE
+++ /dev/null
@@ -1,24 +0,0 @@
-Copyright (c) 2021 Vladimir Mihailenco. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/append.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/append.go
deleted file mode 100644
index a60bf5de2..000000000
--- a/vendor/github.com/uptrace/bun/dialect/pgdialect/append.go
+++ /dev/null
@@ -1,364 +0,0 @@
-package pgdialect
-
-import (
- "database/sql/driver"
- "encoding/hex"
- "fmt"
- "reflect"
- "strconv"
- "time"
- "unicode/utf8"
-
- "github.com/uptrace/bun/dialect"
- "github.com/uptrace/bun/schema"
-)
-
-var (
- driverValuerType = reflect.TypeOf((*driver.Valuer)(nil)).Elem()
-
- stringType = reflect.TypeOf((*string)(nil)).Elem()
- sliceStringType = reflect.TypeOf([]string(nil))
-
- intType = reflect.TypeOf((*int)(nil)).Elem()
- sliceIntType = reflect.TypeOf([]int(nil))
-
- int64Type = reflect.TypeOf((*int64)(nil)).Elem()
- sliceInt64Type = reflect.TypeOf([]int64(nil))
-
- float64Type = reflect.TypeOf((*float64)(nil)).Elem()
- sliceFloat64Type = reflect.TypeOf([]float64(nil))
-)
-
-func arrayAppend(fmter schema.Formatter, b []byte, v interface{}) []byte {
- switch v := v.(type) {
- case int64:
- return strconv.AppendInt(b, v, 10)
- case float64:
- return dialect.AppendFloat64(b, v)
- case bool:
- return dialect.AppendBool(b, v)
- case []byte:
- return arrayAppendBytes(b, v)
- case string:
- return arrayAppendString(b, v)
- case time.Time:
- return fmter.Dialect().AppendTime(b, v)
- default:
- err := fmt.Errorf("pgdialect: can't append %T", v)
- return dialect.AppendError(b, err)
- }
-}
-
-func arrayAppendStringValue(fmter schema.Formatter, b []byte, v reflect.Value) []byte {
- return arrayAppendString(b, v.String())
-}
-
-func arrayAppendBytesValue(fmter schema.Formatter, b []byte, v reflect.Value) []byte {
- return arrayAppendBytes(b, v.Bytes())
-}
-
-func arrayAppendDriverValue(fmter schema.Formatter, b []byte, v reflect.Value) []byte {
- iface, err := v.Interface().(driver.Valuer).Value()
- if err != nil {
- return dialect.AppendError(b, err)
- }
- return arrayAppend(fmter, b, iface)
-}
-
-//------------------------------------------------------------------------------
-
-func (d *Dialect) arrayAppender(typ reflect.Type) schema.AppenderFunc {
- kind := typ.Kind()
-
- switch kind {
- case reflect.Ptr:
- if fn := d.arrayAppender(typ.Elem()); fn != nil {
- return schema.PtrAppender(fn)
- }
- case reflect.Slice, reflect.Array:
- // ok:
- default:
- return nil
- }
-
- elemType := typ.Elem()
-
- if kind == reflect.Slice {
- switch elemType {
- case stringType:
- return appendStringSliceValue
- case intType:
- return appendIntSliceValue
- case int64Type:
- return appendInt64SliceValue
- case float64Type:
- return appendFloat64SliceValue
- }
- }
-
- appendElem := d.arrayElemAppender(elemType)
- if appendElem == nil {
- panic(fmt.Errorf("pgdialect: %s is not supported", typ))
- }
-
- return func(fmter schema.Formatter, b []byte, v reflect.Value) []byte {
- kind := v.Kind()
- switch kind {
- case reflect.Ptr, reflect.Slice:
- if v.IsNil() {
- return dialect.AppendNull(b)
- }
- }
-
- if kind == reflect.Ptr {
- v = v.Elem()
- }
-
- b = append(b, '\'')
-
- b = append(b, '{')
- for i := 0; i < v.Len(); i++ {
- elem := v.Index(i)
- b = appendElem(fmter, b, elem)
- b = append(b, ',')
- }
- if v.Len() > 0 {
- b[len(b)-1] = '}' // Replace trailing comma.
- } else {
- b = append(b, '}')
- }
-
- b = append(b, '\'')
-
- return b
- }
-}
-
-func (d *Dialect) arrayElemAppender(typ reflect.Type) schema.AppenderFunc {
- if typ.Implements(driverValuerType) {
- return arrayAppendDriverValue
- }
- switch typ.Kind() {
- case reflect.String:
- return arrayAppendStringValue
- case reflect.Slice:
- if typ.Elem().Kind() == reflect.Uint8 {
- return arrayAppendBytesValue
- }
- }
- return schema.Appender(d, typ)
-}
-
-func appendStringSliceValue(fmter schema.Formatter, b []byte, v reflect.Value) []byte {
- ss := v.Convert(sliceStringType).Interface().([]string)
- return appendStringSlice(b, ss)
-}
-
-func appendStringSlice(b []byte, ss []string) []byte {
- if ss == nil {
- return dialect.AppendNull(b)
- }
-
- b = append(b, '\'')
-
- b = append(b, '{')
- for _, s := range ss {
- b = arrayAppendString(b, s)
- b = append(b, ',')
- }
- if len(ss) > 0 {
- b[len(b)-1] = '}' // Replace trailing comma.
- } else {
- b = append(b, '}')
- }
-
- b = append(b, '\'')
-
- return b
-}
-
-func appendIntSliceValue(fmter schema.Formatter, b []byte, v reflect.Value) []byte {
- ints := v.Convert(sliceIntType).Interface().([]int)
- return appendIntSlice(b, ints)
-}
-
-func appendIntSlice(b []byte, ints []int) []byte {
- if ints == nil {
- return dialect.AppendNull(b)
- }
-
- b = append(b, '\'')
-
- b = append(b, '{')
- for _, n := range ints {
- b = strconv.AppendInt(b, int64(n), 10)
- b = append(b, ',')
- }
- if len(ints) > 0 {
- b[len(b)-1] = '}' // Replace trailing comma.
- } else {
- b = append(b, '}')
- }
-
- b = append(b, '\'')
-
- return b
-}
-
-func appendInt64SliceValue(fmter schema.Formatter, b []byte, v reflect.Value) []byte {
- ints := v.Convert(sliceInt64Type).Interface().([]int64)
- return appendInt64Slice(b, ints)
-}
-
-func appendInt64Slice(b []byte, ints []int64) []byte {
- if ints == nil {
- return dialect.AppendNull(b)
- }
-
- b = append(b, '\'')
-
- b = append(b, '{')
- for _, n := range ints {
- b = strconv.AppendInt(b, n, 10)
- b = append(b, ',')
- }
- if len(ints) > 0 {
- b[len(b)-1] = '}' // Replace trailing comma.
- } else {
- b = append(b, '}')
- }
-
- b = append(b, '\'')
-
- return b
-}
-
-func appendFloat64SliceValue(fmter schema.Formatter, b []byte, v reflect.Value) []byte {
- floats := v.Convert(sliceFloat64Type).Interface().([]float64)
- return appendFloat64Slice(b, floats)
-}
-
-func appendFloat64Slice(b []byte, floats []float64) []byte {
- if floats == nil {
- return dialect.AppendNull(b)
- }
-
- b = append(b, '\'')
-
- b = append(b, '{')
- for _, n := range floats {
- b = dialect.AppendFloat64(b, n)
- b = append(b, ',')
- }
- if len(floats) > 0 {
- b[len(b)-1] = '}' // Replace trailing comma.
- } else {
- b = append(b, '}')
- }
-
- b = append(b, '\'')
-
- return b
-}
-
-//------------------------------------------------------------------------------
-
-func arrayAppendBytes(b []byte, bs []byte) []byte {
- if bs == nil {
- return dialect.AppendNull(b)
- }
-
- b = append(b, `"\\x`...)
-
- s := len(b)
- b = append(b, make([]byte, hex.EncodedLen(len(bs)))...)
- hex.Encode(b[s:], bs)
-
- b = append(b, '"')
-
- return b
-}
-
-func arrayAppendString(b []byte, s string) []byte {
- b = append(b, '"')
- for _, r := range s {
- switch r {
- case 0:
- // ignore
- case '\'':
- b = append(b, "''"...)
- case '"':
- b = append(b, '\\', '"')
- case '\\':
- b = append(b, '\\', '\\')
- default:
- if r < utf8.RuneSelf {
- b = append(b, byte(r))
- break
- }
- l := len(b)
- if cap(b)-l < utf8.UTFMax {
- b = append(b, make([]byte, utf8.UTFMax)...)
- }
- n := utf8.EncodeRune(b[l:l+utf8.UTFMax], r)
- b = b[:l+n]
- }
- }
- b = append(b, '"')
- return b
-}
-
-//------------------------------------------------------------------------------
-
-var mapStringStringType = reflect.TypeOf(map[string]string(nil))
-
-func (d *Dialect) hstoreAppender(typ reflect.Type) schema.AppenderFunc {
- kind := typ.Kind()
-
- switch kind {
- case reflect.Ptr:
- if fn := d.hstoreAppender(typ.Elem()); fn != nil {
- return schema.PtrAppender(fn)
- }
- case reflect.Map:
- // ok:
- default:
- return nil
- }
-
- if typ.Key() == stringType && typ.Elem() == stringType {
- return appendMapStringStringValue
- }
-
- return func(fmter schema.Formatter, b []byte, v reflect.Value) []byte {
- err := fmt.Errorf("bun: Hstore(unsupported %s)", v.Type())
- return dialect.AppendError(b, err)
- }
-}
-
-func appendMapStringString(b []byte, m map[string]string) []byte {
- if m == nil {
- return dialect.AppendNull(b)
- }
-
- b = append(b, '\'')
-
- for key, value := range m {
- b = arrayAppendString(b, key)
- b = append(b, '=', '>')
- b = arrayAppendString(b, value)
- b = append(b, ',')
- }
- if len(m) > 0 {
- b = b[:len(b)-1] // Strip trailing comma.
- }
-
- b = append(b, '\'')
-
- return b
-}
-
-func appendMapStringStringValue(fmter schema.Formatter, b []byte, v reflect.Value) []byte {
- m := v.Convert(mapStringStringType).Interface().(map[string]string)
- return appendMapStringString(b, m)
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/array.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/array.go
deleted file mode 100644
index 281cff733..000000000
--- a/vendor/github.com/uptrace/bun/dialect/pgdialect/array.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package pgdialect
-
-import (
- "database/sql"
- "fmt"
- "reflect"
-
- "github.com/uptrace/bun/schema"
-)
-
-type ArrayValue struct {
- v reflect.Value
-
- append schema.AppenderFunc
- scan schema.ScannerFunc
-}
-
-// Array accepts a slice and returns a wrapper for working with PostgreSQL
-// array data type.
-//
-// For struct fields you can use array tag:
-//
-// Emails []string `bun:",array"`
-func Array(vi interface{}) *ArrayValue {
- v := reflect.ValueOf(vi)
- if !v.IsValid() {
- panic(fmt.Errorf("bun: Array(nil)"))
- }
-
- return &ArrayValue{
- v: v,
-
- append: pgDialect.arrayAppender(v.Type()),
- scan: arrayScanner(v.Type()),
- }
-}
-
-var (
- _ schema.QueryAppender = (*ArrayValue)(nil)
- _ sql.Scanner = (*ArrayValue)(nil)
-)
-
-func (a *ArrayValue) AppendQuery(fmter schema.Formatter, b []byte) ([]byte, error) {
- if a.append == nil {
- panic(fmt.Errorf("bun: Array(unsupported %s)", a.v.Type()))
- }
- return a.append(fmter, b, a.v), nil
-}
-
-func (a *ArrayValue) Scan(src interface{}) error {
- if a.scan == nil {
- return fmt.Errorf("bun: Array(unsupported %s)", a.v.Type())
- }
- if a.v.Kind() != reflect.Ptr {
- return fmt.Errorf("bun: Array(non-pointer %s)", a.v.Type())
- }
- return a.scan(a.v, src)
-}
-
-func (a *ArrayValue) Value() interface{} {
- if a.v.IsValid() {
- return a.v.Interface()
- }
- return nil
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/array_parser.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/array_parser.go
deleted file mode 100644
index a8358337e..000000000
--- a/vendor/github.com/uptrace/bun/dialect/pgdialect/array_parser.go
+++ /dev/null
@@ -1,133 +0,0 @@
-package pgdialect
-
-import (
- "bytes"
- "encoding/hex"
- "fmt"
- "io"
-)
-
-type arrayParser struct {
- *streamParser
- err error
-}
-
-func newArrayParser(b []byte) *arrayParser {
- p := &arrayParser{
- streamParser: newStreamParser(b, 1),
- }
- if len(b) < 2 || b[0] != '{' || b[len(b)-1] != '}' {
- p.err = fmt.Errorf("bun: can't parse array: %q", b)
- }
- return p
-}
-
-func (p *arrayParser) NextElem() ([]byte, error) {
- if p.err != nil {
- return nil, p.err
- }
-
- c, err := p.readByte()
- if err != nil {
- return nil, err
- }
-
- switch c {
- case '}':
- return nil, io.EOF
- case '"':
- b, err := p.readSubstring()
- if err != nil {
- return nil, err
- }
-
- if p.peek() == ',' {
- p.skipNext()
- }
-
- return b, nil
- default:
- b := p.readSimple()
- if bytes.Equal(b, []byte("NULL")) {
- b = nil
- }
-
- if p.peek() == ',' {
- p.skipNext()
- }
-
- return b, nil
- }
-}
-
-func (p *arrayParser) readSimple() []byte {
- p.unreadByte()
-
- if i := bytes.IndexByte(p.b[p.i:], ','); i >= 0 {
- b := p.b[p.i : p.i+i]
- p.i += i
- return b
- }
-
- b := p.b[p.i : len(p.b)-1]
- p.i = len(p.b) - 1
- return b
-}
-
-func (p *arrayParser) readSubstring() ([]byte, error) {
- c, err := p.readByte()
- if err != nil {
- return nil, err
- }
-
- p.buf = p.buf[:0]
- for {
- if c == '"' {
- break
- }
-
- next, err := p.readByte()
- if err != nil {
- return nil, err
- }
-
- if c == '\\' {
- switch next {
- case '\\', '"':
- p.buf = append(p.buf, next)
-
- c, err = p.readByte()
- if err != nil {
- return nil, err
- }
- default:
- p.buf = append(p.buf, '\\')
- c = next
- }
- continue
- }
- if c == '\'' && next == '\'' {
- p.buf = append(p.buf, next)
- c, err = p.readByte()
- if err != nil {
- return nil, err
- }
- continue
- }
-
- p.buf = append(p.buf, c)
- c = next
- }
-
- if bytes.HasPrefix(p.buf, []byte("\\x")) && len(p.buf)%2 == 0 {
- data := p.buf[2:]
- buf := make([]byte, hex.DecodedLen(len(data)))
- n, err := hex.Decode(buf, data)
- if err != nil {
- return nil, err
- }
- return buf[:n], nil
- }
-
- return p.buf, nil
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/array_scan.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/array_scan.go
deleted file mode 100644
index a8ff29715..000000000
--- a/vendor/github.com/uptrace/bun/dialect/pgdialect/array_scan.go
+++ /dev/null
@@ -1,302 +0,0 @@
-package pgdialect
-
-import (
- "fmt"
- "io"
- "reflect"
- "strconv"
-
- "github.com/uptrace/bun/internal"
- "github.com/uptrace/bun/schema"
-)
-
-func arrayScanner(typ reflect.Type) schema.ScannerFunc {
- kind := typ.Kind()
-
- switch kind {
- case reflect.Ptr:
- if fn := arrayScanner(typ.Elem()); fn != nil {
- return schema.PtrScanner(fn)
- }
- case reflect.Slice, reflect.Array:
- // ok:
- default:
- return nil
- }
-
- elemType := typ.Elem()
-
- if kind == reflect.Slice {
- switch elemType {
- case stringType:
- return scanStringSliceValue
- case intType:
- return scanIntSliceValue
- case int64Type:
- return scanInt64SliceValue
- case float64Type:
- return scanFloat64SliceValue
- }
- }
-
- scanElem := schema.Scanner(elemType)
- return func(dest reflect.Value, src interface{}) error {
- dest = reflect.Indirect(dest)
- if !dest.CanSet() {
- return fmt.Errorf("bun: Scan(non-settable %s)", dest.Type())
- }
-
- kind := dest.Kind()
-
- if src == nil {
- if kind != reflect.Slice || !dest.IsNil() {
- dest.Set(reflect.Zero(dest.Type()))
- }
- return nil
- }
-
- if kind == reflect.Slice {
- if dest.IsNil() {
- dest.Set(reflect.MakeSlice(dest.Type(), 0, 0))
- } else if dest.Len() > 0 {
- dest.Set(dest.Slice(0, 0))
- }
- }
-
- b, err := toBytes(src)
- if err != nil {
- return err
- }
-
- p := newArrayParser(b)
- nextValue := internal.MakeSliceNextElemFunc(dest)
- for {
- elem, err := p.NextElem()
- if err != nil {
- if err == io.EOF {
- break
- }
- return err
- }
-
- elemValue := nextValue()
- if err := scanElem(elemValue, elem); err != nil {
- return err
- }
- }
-
- return nil
- }
-}
-
-func scanStringSliceValue(dest reflect.Value, src interface{}) error {
- dest = reflect.Indirect(dest)
- if !dest.CanSet() {
- return fmt.Errorf("bun: Scan(non-settable %s)", dest.Type())
- }
-
- slice, err := decodeStringSlice(src)
- if err != nil {
- return err
- }
-
- dest.Set(reflect.ValueOf(slice))
- return nil
-}
-
-func decodeStringSlice(src interface{}) ([]string, error) {
- if src == nil {
- return nil, nil
- }
-
- b, err := toBytes(src)
- if err != nil {
- return nil, err
- }
-
- slice := make([]string, 0)
-
- p := newArrayParser(b)
- for {
- elem, err := p.NextElem()
- if err != nil {
- if err == io.EOF {
- break
- }
- return nil, err
- }
- slice = append(slice, string(elem))
- }
-
- return slice, nil
-}
-
-func scanIntSliceValue(dest reflect.Value, src interface{}) error {
- dest = reflect.Indirect(dest)
- if !dest.CanSet() {
- return fmt.Errorf("bun: Scan(non-settable %s)", dest.Type())
- }
-
- slice, err := decodeIntSlice(src)
- if err != nil {
- return err
- }
-
- dest.Set(reflect.ValueOf(slice))
- return nil
-}
-
-func decodeIntSlice(src interface{}) ([]int, error) {
- if src == nil {
- return nil, nil
- }
-
- b, err := toBytes(src)
- if err != nil {
- return nil, err
- }
-
- slice := make([]int, 0)
-
- p := newArrayParser(b)
- for {
- elem, err := p.NextElem()
- if err != nil {
- if err == io.EOF {
- break
- }
- return nil, err
- }
-
- if elem == nil {
- slice = append(slice, 0)
- continue
- }
-
- n, err := strconv.Atoi(bytesToString(elem))
- if err != nil {
- return nil, err
- }
-
- slice = append(slice, n)
- }
-
- return slice, nil
-}
-
-func scanInt64SliceValue(dest reflect.Value, src interface{}) error {
- dest = reflect.Indirect(dest)
- if !dest.CanSet() {
- return fmt.Errorf("bun: Scan(non-settable %s)", dest.Type())
- }
-
- slice, err := decodeInt64Slice(src)
- if err != nil {
- return err
- }
-
- dest.Set(reflect.ValueOf(slice))
- return nil
-}
-
-func decodeInt64Slice(src interface{}) ([]int64, error) {
- if src == nil {
- return nil, nil
- }
-
- b, err := toBytes(src)
- if err != nil {
- return nil, err
- }
-
- slice := make([]int64, 0)
-
- p := newArrayParser(b)
- for {
- elem, err := p.NextElem()
- if err != nil {
- if err == io.EOF {
- break
- }
- return nil, err
- }
-
- if elem == nil {
- slice = append(slice, 0)
- continue
- }
-
- n, err := strconv.ParseInt(bytesToString(elem), 10, 64)
- if err != nil {
- return nil, err
- }
-
- slice = append(slice, n)
- }
-
- return slice, nil
-}
-
-func scanFloat64SliceValue(dest reflect.Value, src interface{}) error {
- dest = reflect.Indirect(dest)
- if !dest.CanSet() {
- return fmt.Errorf("bun: Scan(non-settable %s)", dest.Type())
- }
-
- slice, err := scanFloat64Slice(src)
- if err != nil {
- return err
- }
-
- dest.Set(reflect.ValueOf(slice))
- return nil
-}
-
-func scanFloat64Slice(src interface{}) ([]float64, error) {
- if src == -1 {
- return nil, nil
- }
-
- b, err := toBytes(src)
- if err != nil {
- return nil, err
- }
-
- slice := make([]float64, 0)
-
- p := newArrayParser(b)
- for {
- elem, err := p.NextElem()
- if err != nil {
- if err == io.EOF {
- break
- }
- return nil, err
- }
-
- if elem == nil {
- slice = append(slice, 0)
- continue
- }
-
- n, err := strconv.ParseFloat(bytesToString(elem), 64)
- if err != nil {
- return nil, err
- }
-
- slice = append(slice, n)
- }
-
- return slice, nil
-}
-
-func toBytes(src interface{}) ([]byte, error) {
- switch src := src.(type) {
- case string:
- return stringToBytes(src), nil
- case []byte:
- return src, nil
- default:
- return nil, fmt.Errorf("bun: got %T, wanted []byte or string", src)
- }
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/dialect.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/dialect.go
deleted file mode 100644
index d524f0a1a..000000000
--- a/vendor/github.com/uptrace/bun/dialect/pgdialect/dialect.go
+++ /dev/null
@@ -1,109 +0,0 @@
-package pgdialect
-
-import (
- "database/sql"
- "fmt"
- "strconv"
- "strings"
-
- "github.com/uptrace/bun"
- "github.com/uptrace/bun/dialect"
- "github.com/uptrace/bun/dialect/feature"
- "github.com/uptrace/bun/dialect/sqltype"
- "github.com/uptrace/bun/schema"
-)
-
-var pgDialect = New()
-
-func init() {
- if Version() != bun.Version() {
- panic(fmt.Errorf("pgdialect and Bun must have the same version: v%s != v%s",
- Version(), bun.Version()))
- }
-}
-
-type Dialect struct {
- schema.BaseDialect
-
- tables *schema.Tables
- features feature.Feature
-}
-
-func New() *Dialect {
- d := new(Dialect)
- d.tables = schema.NewTables(d)
- d.features = feature.CTE |
- feature.WithValues |
- feature.Returning |
- feature.InsertReturning |
- feature.DefaultPlaceholder |
- feature.DoubleColonCast |
- feature.InsertTableAlias |
- feature.UpdateTableAlias |
- feature.DeleteTableAlias |
- feature.TableCascade |
- feature.TableIdentity |
- feature.TableTruncate |
- feature.TableNotExists |
- feature.InsertOnConflict |
- feature.SelectExists |
- feature.GeneratedIdentity
- return d
-}
-
-func (d *Dialect) Init(*sql.DB) {}
-
-func (d *Dialect) Name() dialect.Name {
- return dialect.PG
-}
-
-func (d *Dialect) Features() feature.Feature {
- return d.features
-}
-
-func (d *Dialect) Tables() *schema.Tables {
- return d.tables
-}
-
-func (d *Dialect) OnTable(table *schema.Table) {
- for _, field := range table.FieldMap {
- d.onField(field)
- }
-}
-
-func (d *Dialect) onField(field *schema.Field) {
- field.DiscoveredSQLType = fieldSQLType(field)
-
- if field.AutoIncrement && !field.Identity {
- switch field.DiscoveredSQLType {
- case sqltype.SmallInt:
- field.CreateTableSQLType = pgTypeSmallSerial
- case sqltype.Integer:
- field.CreateTableSQLType = pgTypeSerial
- case sqltype.BigInt:
- field.CreateTableSQLType = pgTypeBigSerial
- }
- }
-
- if field.Tag.HasOption("array") || strings.HasSuffix(field.UserSQLType, "[]") {
- field.Append = d.arrayAppender(field.StructField.Type)
- field.Scan = arrayScanner(field.StructField.Type)
- }
-
- if field.DiscoveredSQLType == sqltype.HSTORE {
- field.Append = d.hstoreAppender(field.StructField.Type)
- field.Scan = hstoreScanner(field.StructField.Type)
- }
-}
-
-func (d *Dialect) IdentQuote() byte {
- return '"'
-}
-
-func (d *Dialect) AppendUint32(b []byte, n uint32) []byte {
- return strconv.AppendInt(b, int64(int32(n)), 10)
-}
-
-func (d *Dialect) AppendUint64(b []byte, n uint64) []byte {
- return strconv.AppendInt(b, int64(n), 10)
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/hstore.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/hstore.go
deleted file mode 100644
index 029f7cb6d..000000000
--- a/vendor/github.com/uptrace/bun/dialect/pgdialect/hstore.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package pgdialect
-
-import (
- "database/sql"
- "fmt"
- "reflect"
-
- "github.com/uptrace/bun/schema"
-)
-
-type HStoreValue struct {
- v reflect.Value
-
- append schema.AppenderFunc
- scan schema.ScannerFunc
-}
-
-// HStore accepts a map[string]string and returns a wrapper for working with PostgreSQL
-// hstore data type.
-//
-// For struct fields you can use hstore tag:
-//
-// Attrs map[string]string `bun:",hstore"`
-func HStore(vi interface{}) *HStoreValue {
- v := reflect.ValueOf(vi)
- if !v.IsValid() {
- panic(fmt.Errorf("bun: HStore(nil)"))
- }
-
- typ := v.Type()
- if typ.Kind() == reflect.Ptr {
- typ = typ.Elem()
- }
- if typ.Kind() != reflect.Map {
- panic(fmt.Errorf("bun: Hstore(unsupported %s)", typ))
- }
-
- return &HStoreValue{
- v: v,
-
- append: pgDialect.hstoreAppender(v.Type()),
- scan: hstoreScanner(v.Type()),
- }
-}
-
-var (
- _ schema.QueryAppender = (*HStoreValue)(nil)
- _ sql.Scanner = (*HStoreValue)(nil)
-)
-
-func (h *HStoreValue) AppendQuery(fmter schema.Formatter, b []byte) ([]byte, error) {
- if h.append == nil {
- panic(fmt.Errorf("bun: HStore(unsupported %s)", h.v.Type()))
- }
- return h.append(fmter, b, h.v), nil
-}
-
-func (h *HStoreValue) Scan(src interface{}) error {
- if h.scan == nil {
- return fmt.Errorf("bun: HStore(unsupported %s)", h.v.Type())
- }
- if h.v.Kind() != reflect.Ptr {
- return fmt.Errorf("bun: HStore(non-pointer %s)", h.v.Type())
- }
- return h.scan(h.v.Elem(), src)
-}
-
-func (h *HStoreValue) Value() interface{} {
- if h.v.IsValid() {
- return h.v.Interface()
- }
- return nil
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/hstore_parser.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/hstore_parser.go
deleted file mode 100644
index 7a18b50b1..000000000
--- a/vendor/github.com/uptrace/bun/dialect/pgdialect/hstore_parser.go
+++ /dev/null
@@ -1,142 +0,0 @@
-package pgdialect
-
-import (
- "bytes"
- "fmt"
-)
-
-type hstoreParser struct {
- *streamParser
- err error
-}
-
-func newHStoreParser(b []byte) *hstoreParser {
- p := &hstoreParser{
- streamParser: newStreamParser(b, 0),
- }
- if len(b) < 6 || b[0] != '"' {
- p.err = fmt.Errorf("bun: can't parse hstore: %q", b)
- }
- return p
-}
-
-func (p *hstoreParser) NextKey() (string, error) {
- if p.err != nil {
- return "", p.err
- }
-
- err := p.skipByte('"')
- if err != nil {
- return "", err
- }
-
- key, err := p.readSubstring()
- if err != nil {
- return "", err
- }
-
- const separator = "=>"
-
- for i := range separator {
- err = p.skipByte(separator[i])
- if err != nil {
- return "", err
- }
- }
-
- return string(key), nil
-}
-
-func (p *hstoreParser) NextValue() (string, error) {
- if p.err != nil {
- return "", p.err
- }
-
- c, err := p.readByte()
- if err != nil {
- return "", err
- }
-
- switch c {
- case '"':
- value, err := p.readSubstring()
- if err != nil {
- return "", err
- }
-
- if p.peek() == ',' {
- p.skipNext()
- }
-
- if p.peek() == ' ' {
- p.skipNext()
- }
-
- return string(value), nil
- default:
- value := p.readSimple()
- if bytes.Equal(value, []byte("NULL")) {
- value = nil
- }
-
- if p.peek() == ',' {
- p.skipNext()
- }
-
- return string(value), nil
- }
-}
-
-func (p *hstoreParser) readSimple() []byte {
- p.unreadByte()
-
- if i := bytes.IndexByte(p.b[p.i:], ','); i >= 0 {
- b := p.b[p.i : p.i+i]
- p.i += i
- return b
- }
-
- b := p.b[p.i:len(p.b)]
- p.i = len(p.b)
- return b
-}
-
-func (p *hstoreParser) readSubstring() ([]byte, error) {
- c, err := p.readByte()
- if err != nil {
- return nil, err
- }
-
- p.buf = p.buf[:0]
- for {
- if c == '"' {
- break
- }
-
- next, err := p.readByte()
- if err != nil {
- return nil, err
- }
-
- if c == '\\' {
- switch next {
- case '\\', '"':
- p.buf = append(p.buf, next)
-
- c, err = p.readByte()
- if err != nil {
- return nil, err
- }
- default:
- p.buf = append(p.buf, '\\')
- c = next
- }
- continue
- }
-
- p.buf = append(p.buf, c)
- c = next
- }
-
- return p.buf, nil
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/hstore_scan.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/hstore_scan.go
deleted file mode 100644
index b10b06b8d..000000000
--- a/vendor/github.com/uptrace/bun/dialect/pgdialect/hstore_scan.go
+++ /dev/null
@@ -1,82 +0,0 @@
-package pgdialect
-
-import (
- "fmt"
- "io"
- "reflect"
-
- "github.com/uptrace/bun/schema"
-)
-
-func hstoreScanner(typ reflect.Type) schema.ScannerFunc {
- kind := typ.Kind()
-
- switch kind {
- case reflect.Ptr:
- if fn := hstoreScanner(typ.Elem()); fn != nil {
- return schema.PtrScanner(fn)
- }
- case reflect.Map:
- // ok:
- default:
- return nil
- }
-
- if typ.Key() == stringType && typ.Elem() == stringType {
- return scanMapStringStringValue
- }
- return func(dest reflect.Value, src interface{}) error {
- return fmt.Errorf("bun: Hstore(unsupported %s)", dest.Type())
- }
-}
-
-func scanMapStringStringValue(dest reflect.Value, src interface{}) error {
- dest = reflect.Indirect(dest)
- if !dest.CanSet() {
- return fmt.Errorf("bun: Scan(non-settable %s)", dest.Type())
- }
-
- m, err := decodeMapStringString(src)
- if err != nil {
- return err
- }
-
- dest.Set(reflect.ValueOf(m))
- return nil
-}
-
-func decodeMapStringString(src interface{}) (map[string]string, error) {
- if src == nil {
- return nil, nil
- }
-
- b, err := toBytes(src)
- if err != nil {
- return nil, err
- }
-
- m := make(map[string]string)
-
- p := newHStoreParser(b)
- for {
- key, err := p.NextKey()
- if err != nil {
- if err == io.EOF {
- break
- }
- return nil, err
- }
-
- value, err := p.NextValue()
- if err != nil {
- if err == io.EOF {
- break
- }
- return nil, err
- }
-
- m[key] = value
- }
-
- return m, nil
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/safe.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/safe.go
deleted file mode 100644
index dff30b9c5..000000000
--- a/vendor/github.com/uptrace/bun/dialect/pgdialect/safe.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// +build appengine
-
-package pgdialect
-
-func bytesToString(b []byte) string {
- return string(b)
-}
-
-func stringToBytes(s string) []byte {
- return []byte(s)
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/scan.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/scan.go
deleted file mode 100644
index e06bb8bc2..000000000
--- a/vendor/github.com/uptrace/bun/dialect/pgdialect/scan.go
+++ /dev/null
@@ -1,11 +0,0 @@
-package pgdialect
-
-import (
- "reflect"
-
- "github.com/uptrace/bun/schema"
-)
-
-func scanner(typ reflect.Type) schema.ScannerFunc {
- return schema.Scanner(typ)
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/sqltype.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/sqltype.go
deleted file mode 100644
index 6c6294d71..000000000
--- a/vendor/github.com/uptrace/bun/dialect/pgdialect/sqltype.go
+++ /dev/null
@@ -1,105 +0,0 @@
-package pgdialect
-
-import (
- "encoding/json"
- "net"
- "reflect"
-
- "github.com/uptrace/bun/dialect/sqltype"
- "github.com/uptrace/bun/schema"
-)
-
-const (
- // Date / Time
- pgTypeTimestampTz = "TIMESTAMPTZ" // Timestamp with a time zone
- pgTypeDate = "DATE" // Date
- pgTypeTime = "TIME" // Time without a time zone
- pgTypeTimeTz = "TIME WITH TIME ZONE" // Time with a time zone
- pgTypeInterval = "INTERVAL" // Time Interval
-
- // Network Addresses
- pgTypeInet = "INET" // IPv4 or IPv6 hosts and networks
- pgTypeCidr = "CIDR" // IPv4 or IPv6 networks
- pgTypeMacaddr = "MACADDR" // MAC addresses
-
- // Serial Types
- pgTypeSmallSerial = "SMALLSERIAL" // 2 byte autoincrementing integer
- pgTypeSerial = "SERIAL" // 4 byte autoincrementing integer
- pgTypeBigSerial = "BIGSERIAL" // 8 byte autoincrementing integer
-
- // Character Types
- pgTypeChar = "CHAR" // fixed length string (blank padded)
- pgTypeText = "TEXT" // variable length string without limit
-
- // JSON Types
- pgTypeJSON = "JSON" // text representation of json data
- pgTypeJSONB = "JSONB" // binary representation of json data
-
- // Binary Data Types
- pgTypeBytea = "BYTEA" // binary string
-)
-
-var (
- ipType = reflect.TypeOf((*net.IP)(nil)).Elem()
- ipNetType = reflect.TypeOf((*net.IPNet)(nil)).Elem()
- jsonRawMessageType = reflect.TypeOf((*json.RawMessage)(nil)).Elem()
-)
-
-func fieldSQLType(field *schema.Field) string {
- if field.UserSQLType != "" {
- return field.UserSQLType
- }
-
- if v, ok := field.Tag.Option("composite"); ok {
- return v
- }
- if field.Tag.HasOption("hstore") {
- return sqltype.HSTORE
- }
-
- if field.Tag.HasOption("array") {
- switch field.IndirectType.Kind() {
- case reflect.Slice, reflect.Array:
- sqlType := sqlType(field.IndirectType.Elem())
- return sqlType + "[]"
- }
- }
-
- if field.DiscoveredSQLType == sqltype.Blob {
- return pgTypeBytea
- }
-
- return sqlType(field.IndirectType)
-}
-
-func sqlType(typ reflect.Type) string {
- switch typ {
- case ipType:
- return pgTypeInet
- case ipNetType:
- return pgTypeCidr
- case jsonRawMessageType:
- return pgTypeJSONB
- }
-
- sqlType := schema.DiscoverSQLType(typ)
- switch sqlType {
- case sqltype.Timestamp:
- sqlType = pgTypeTimestampTz
- }
-
- switch typ.Kind() {
- case reflect.Map, reflect.Struct:
- if sqlType == sqltype.VarChar {
- return pgTypeJSONB
- }
- return sqlType
- case reflect.Array, reflect.Slice:
- if typ.Elem().Kind() == reflect.Uint8 {
- return pgTypeBytea
- }
- return pgTypeJSONB
- }
-
- return sqlType
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/stream_parser.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/stream_parser.go
deleted file mode 100644
index 7b9a15f62..000000000
--- a/vendor/github.com/uptrace/bun/dialect/pgdialect/stream_parser.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package pgdialect
-
-import (
- "fmt"
- "io"
-)
-
-type streamParser struct {
- b []byte
- i int
-
- buf []byte
-}
-
-func newStreamParser(b []byte, start int) *streamParser {
- return &streamParser{
- b: b,
- i: start,
- }
-}
-
-func (p *streamParser) valid() bool {
- return p.i < len(p.b)
-}
-
-func (p *streamParser) skipByte(skip byte) error {
- c, err := p.readByte()
- if err != nil {
- return err
- }
- if c == skip {
- return nil
- }
- p.unreadByte()
- return fmt.Errorf("got %q, wanted %q", c, skip)
-}
-
-func (p *streamParser) readByte() (byte, error) {
- if p.valid() {
- c := p.b[p.i]
- p.i++
- return c, nil
- }
- return 0, io.EOF
-}
-
-func (p *streamParser) unreadByte() {
- p.i--
-}
-
-func (p *streamParser) peek() byte {
- if p.valid() {
- return p.b[p.i]
- }
- return 0
-}
-
-func (p *streamParser) skipNext() {
- p.i++
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/unsafe.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/unsafe.go
deleted file mode 100644
index 2a02a20b1..000000000
--- a/vendor/github.com/uptrace/bun/dialect/pgdialect/unsafe.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// +build !appengine
-
-package pgdialect
-
-import "unsafe"
-
-func bytesToString(b []byte) string {
- return *(*string)(unsafe.Pointer(&b))
-}
-
-func stringToBytes(s string) []byte {
- return *(*[]byte)(unsafe.Pointer(
- &struct {
- string
- Cap int
- }{s, len(s)},
- ))
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/version.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/version.go
deleted file mode 100644
index 8ab18b7a7..000000000
--- a/vendor/github.com/uptrace/bun/dialect/pgdialect/version.go
+++ /dev/null
@@ -1,6 +0,0 @@
-package pgdialect
-
-// Version is the current release version.
-func Version() string {
- return "1.1.7"
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/sqlitedialect/LICENSE b/vendor/github.com/uptrace/bun/dialect/sqlitedialect/LICENSE
deleted file mode 100644
index 7ec81810c..000000000
--- a/vendor/github.com/uptrace/bun/dialect/sqlitedialect/LICENSE
+++ /dev/null
@@ -1,24 +0,0 @@
-Copyright (c) 2021 Vladimir Mihailenco. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/uptrace/bun/dialect/sqlitedialect/dialect.go b/vendor/github.com/uptrace/bun/dialect/sqlitedialect/dialect.go
deleted file mode 100644
index e79dcb004..000000000
--- a/vendor/github.com/uptrace/bun/dialect/sqlitedialect/dialect.go
+++ /dev/null
@@ -1,98 +0,0 @@
-package sqlitedialect
-
-import (
- "database/sql"
- "encoding/hex"
- "fmt"
-
- "github.com/uptrace/bun"
- "github.com/uptrace/bun/dialect"
- "github.com/uptrace/bun/dialect/feature"
- "github.com/uptrace/bun/dialect/sqltype"
- "github.com/uptrace/bun/schema"
-)
-
-func init() {
- if Version() != bun.Version() {
- panic(fmt.Errorf("sqlitedialect and Bun must have the same version: v%s != v%s",
- Version(), bun.Version()))
- }
-}
-
-type Dialect struct {
- schema.BaseDialect
-
- tables *schema.Tables
- features feature.Feature
-}
-
-func New() *Dialect {
- d := new(Dialect)
- d.tables = schema.NewTables(d)
- d.features = feature.CTE |
- feature.WithValues |
- feature.Returning |
- feature.InsertReturning |
- feature.InsertTableAlias |
- feature.UpdateTableAlias |
- feature.DeleteTableAlias |
- feature.InsertOnConflict |
- feature.TableNotExists |
- feature.SelectExists
- return d
-}
-
-func (d *Dialect) Init(*sql.DB) {}
-
-func (d *Dialect) Name() dialect.Name {
- return dialect.SQLite
-}
-
-func (d *Dialect) Features() feature.Feature {
- return d.features
-}
-
-func (d *Dialect) Tables() *schema.Tables {
- return d.tables
-}
-
-func (d *Dialect) OnTable(table *schema.Table) {
- for _, field := range table.FieldMap {
- d.onField(field)
- }
-}
-
-func (d *Dialect) onField(field *schema.Field) {
- field.DiscoveredSQLType = fieldSQLType(field)
-}
-
-func (d *Dialect) IdentQuote() byte {
- return '"'
-}
-
-func (d *Dialect) AppendBytes(b []byte, bs []byte) []byte {
- if bs == nil {
- return dialect.AppendNull(b)
- }
-
- b = append(b, `X'`...)
-
- s := len(b)
- b = append(b, make([]byte, hex.EncodedLen(len(bs)))...)
- hex.Encode(b[s:], bs)
-
- b = append(b, '\'')
-
- return b
-}
-
-func fieldSQLType(field *schema.Field) string {
- switch field.DiscoveredSQLType {
- case sqltype.SmallInt, sqltype.BigInt:
- // INTEGER PRIMARY KEY is an alias for the ROWID.
- // It is safe to convert all ints to INTEGER, because SQLite types don't have size.
- return sqltype.Integer
- default:
- return field.DiscoveredSQLType
- }
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/sqlitedialect/scan.go b/vendor/github.com/uptrace/bun/dialect/sqlitedialect/scan.go
deleted file mode 100644
index f6f02b55a..000000000
--- a/vendor/github.com/uptrace/bun/dialect/sqlitedialect/scan.go
+++ /dev/null
@@ -1,11 +0,0 @@
-package sqlitedialect
-
-import (
- "reflect"
-
- "github.com/uptrace/bun/schema"
-)
-
-func scanner(typ reflect.Type) schema.ScannerFunc {
- return schema.Scanner(typ)
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/sqlitedialect/version.go b/vendor/github.com/uptrace/bun/dialect/sqlitedialect/version.go
deleted file mode 100644
index 8f9def8d0..000000000
--- a/vendor/github.com/uptrace/bun/dialect/sqlitedialect/version.go
+++ /dev/null
@@ -1,6 +0,0 @@
-package sqlitedialect
-
-// Version is the current release version.
-func Version() string {
- return "1.1.7"
-}
diff --git a/vendor/github.com/uptrace/bun/dialect/sqltype/sqltype.go b/vendor/github.com/uptrace/bun/dialect/sqltype/sqltype.go
deleted file mode 100644
index 1031fd352..000000000
--- a/vendor/github.com/uptrace/bun/dialect/sqltype/sqltype.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package sqltype
-
-const (
- Boolean = "BOOLEAN"
- SmallInt = "SMALLINT"
- Integer = "INTEGER"
- BigInt = "BIGINT"
- Real = "REAL"
- DoublePrecision = "DOUBLE PRECISION"
- VarChar = "VARCHAR"
- Blob = "BLOB"
- Timestamp = "TIMESTAMP"
- JSON = "JSON"
- JSONB = "JSONB"
- HSTORE = "HSTORE"
-)