Vendor packages update

This commit is contained in:
2025-12-19 22:27:20 +02:00
parent 79effe6921
commit d9225a7310
196 changed files with 28595 additions and 1 deletions

105
vendor/github.com/uptrace/bun/dialect/append.go generated vendored Normal file
View File

@@ -0,0 +1,105 @@
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, num float32) []byte {
return appendFloat(b, float64(num), 32)
}
func AppendFloat64(b []byte, num float64) []byte {
return appendFloat(b, num, 64)
}
func appendFloat(b []byte, num float64, bitSize int) []byte {
switch {
case math.IsNaN(num):
return append(b, "'NaN'"...)
case math.IsInf(num, 1):
return append(b, "'Infinity'"...)
case math.IsInf(num, -1):
return append(b, "'-Infinity'"...)
default:
return strconv.AppendFloat(b, num, 'f', -1, bitSize)
}
}
//------------------------------------------------------------------------------
func AppendName(b []byte, ident string, quote byte) []byte {
return appendName(b, internal.Bytes(ident), quote)
}
func appendName(b, ident []byte, quote byte) []byte {
b = append(b, quote)
for _, c := range ident {
if c == quote {
b = append(b, quote, quote)
} else {
b = append(b, c)
}
}
b = append(b, quote)
return b
}
func AppendIdent(b []byte, name string, quote byte) []byte {
return appendIdent(b, internal.Bytes(name), quote)
}
func appendIdent(b, name []byte, quote byte) []byte {
var quoted bool
loop:
for _, c := range name {
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
}

31
vendor/github.com/uptrace/bun/dialect/dialect.go generated vendored Normal file
View File

@@ -0,0 +1,31 @@
package dialect
type Name int
func (n Name) String() string {
switch n {
case Invalid:
return "invalid"
case PG:
return "pg"
case SQLite:
return "sqlite"
case MySQL:
return "mysql"
case MSSQL:
return "mssql"
case Oracle:
return "oracle"
default:
return "custom"
}
}
const (
Invalid Name = iota
PG
SQLite
MySQL
MSSQL
Oracle
)

View File

@@ -0,0 +1,98 @@
package feature
import (
"fmt"
"strconv"
"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
CompositeIn // ... WHERE (A,B) IN ((N, NN), (N, NN)...)
UpdateOrderLimit // UPDATE ... ORDER BY ... LIMIT ...
DeleteOrderLimit // DELETE ... ORDER BY ... LIMIT ...
DeleteReturning
MergeReturning
AlterColumnExists // ADD/DROP COLUMN IF NOT EXISTS/IF EXISTS
FKDefaultOnAction // FK ON UPDATE/ON DELETE has default value: NO ACTION
)
type NotSupportError struct {
Flag Feature
}
func (err *NotSupportError) Error() string {
name, ok := flag2str[err.Flag]
if !ok {
name = strconv.FormatInt(int64(err.Flag), 10)
}
return fmt.Sprintf("bun: feature %s is not supported by current dialect", name)
}
func NewNotSupportError(flag Feature) *NotSupportError {
return &NotSupportError{Flag: flag}
}
var flag2str = map[Feature]string{
CTE: "CTE",
WithValues: "WithValues",
Returning: "Returning",
InsertReturning: "InsertReturning",
Output: "Output",
DefaultPlaceholder: "DefaultPlaceholder",
DoubleColonCast: "DoubleColonCast",
ValuesRow: "ValuesRow",
UpdateMultiTable: "UpdateMultiTable",
InsertTableAlias: "InsertTableAlias",
UpdateTableAlias: "UpdateTableAlias",
DeleteTableAlias: "DeleteTableAlias",
AutoIncrement: "AutoIncrement",
Identity: "Identity",
TableCascade: "TableCascade",
TableIdentity: "TableIdentity",
TableTruncate: "TableTruncate",
InsertOnConflict: "InsertOnConflict",
InsertOnDuplicateKey: "InsertOnDuplicateKey",
InsertIgnore: "InsertIgnore",
TableNotExists: "TableNotExists",
OffsetFetch: "OffsetFetch",
SelectExists: "SelectExists",
UpdateFromTable: "UpdateFromTable",
MSSavepoint: "MSSavepoint",
GeneratedIdentity: "GeneratedIdentity",
CompositeIn: "CompositeIn",
UpdateOrderLimit: "UpdateOrderLimit",
DeleteOrderLimit: "DeleteOrderLimit",
DeleteReturning: "DeleteReturning",
MergeReturning: "MergeReturning",
AlterColumnExists: "AlterColumnExists",
FKDefaultOnAction: "FKDefaultOnAction",
}

View File

@@ -0,0 +1,16 @@
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"
)