mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-10-31 22:40:01 +00:00
[chore] bump bun v1.1.14 -> v1.1.15 (#2195)
This commit is contained in:
parent
23dd6f664c
commit
7011f57b09
27 changed files with 273 additions and 90 deletions
10
go.mod
10
go.mod
|
@ -47,10 +47,10 @@ require (
|
|||
github.com/superseriousbusiness/oauth2/v4 v4.3.2-SSB.0.20230227143000-f4900831d6c8
|
||||
github.com/tdewolff/minify/v2 v2.12.9
|
||||
github.com/ulule/limiter/v3 v3.11.2
|
||||
github.com/uptrace/bun v1.1.14
|
||||
github.com/uptrace/bun/dialect/pgdialect v1.1.14
|
||||
github.com/uptrace/bun/dialect/sqlitedialect v1.1.14
|
||||
github.com/uptrace/bun/extra/bunotel v1.1.14
|
||||
github.com/uptrace/bun v1.1.15
|
||||
github.com/uptrace/bun/dialect/pgdialect v1.1.15
|
||||
github.com/uptrace/bun/dialect/sqlitedialect v1.1.15
|
||||
github.com/uptrace/bun/extra/bunotel v1.1.15
|
||||
github.com/wagslane/go-password-validator v0.3.0
|
||||
github.com/yuin/goldmark v1.5.6
|
||||
go.opentelemetry.io/otel v1.17.0
|
||||
|
@ -156,7 +156,7 @@ require (
|
|||
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.11 // indirect
|
||||
github.com/uptrace/opentelemetry-go-extra/otelsql v0.2.1 // indirect
|
||||
github.com/uptrace/opentelemetry-go-extra/otelsql v0.2.2 // indirect
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0 // indirect
|
||||
|
|
20
go.sum
20
go.sum
|
@ -576,16 +576,16 @@ github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4d
|
|||
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/ulule/limiter/v3 v3.11.2 h1:P4yOrxoEMJbOTfRJR2OzjL90oflzYPPmWg+dvwN2tHA=
|
||||
github.com/ulule/limiter/v3 v3.11.2/go.mod h1:QG5GnFOCV+k7lrL5Y8kgEeeflPH3+Cviqlqa8SVSQxI=
|
||||
github.com/uptrace/bun v1.1.14 h1:S5vvNnjEynJ0CvnrBOD7MIRW7q/WbtvFXrdfy0lddAM=
|
||||
github.com/uptrace/bun v1.1.14/go.mod h1:RHk6DrIisO62dv10pUOJCz5MphXThuOTpVNYEYv7NI8=
|
||||
github.com/uptrace/bun/dialect/pgdialect v1.1.14 h1:b7+V1KDJPQSFYgkG/6YLXCl2uvwEY3kf/GSM7hTHRDY=
|
||||
github.com/uptrace/bun/dialect/pgdialect v1.1.14/go.mod h1:v6YiaXmnKQ2FlhRD2c0ZfKd+QXH09pYn4H8ojaavkKk=
|
||||
github.com/uptrace/bun/dialect/sqlitedialect v1.1.14 h1:SlwXLxr+N1kEo8Q0cheRlnIZLZlWniEB1OI+jkiLgWE=
|
||||
github.com/uptrace/bun/dialect/sqlitedialect v1.1.14/go.mod h1:9RTEj1l4bB9a4l1Mnc9y4COTwWlFYe1dh6fyxq1rR7A=
|
||||
github.com/uptrace/bun/extra/bunotel v1.1.14 h1:jKA1zNfD2/Y/O3eFP15ao+V0cMigXN+ReNbsVUqrOhg=
|
||||
github.com/uptrace/bun/extra/bunotel v1.1.14/go.mod h1:BBuePZ4ciMqoeyRfef4GL7Z75FsiOm3Q3fvNt0z4sQk=
|
||||
github.com/uptrace/opentelemetry-go-extra/otelsql v0.2.1 h1:sCYkntVVoSMuQuyRBaEkedb1qS1KeJJaqKbdtNfTsfM=
|
||||
github.com/uptrace/opentelemetry-go-extra/otelsql v0.2.1/go.mod h1:1frv9RN1rlTq0jzCq+mVuEQisubZCQ4OU6S/8CaHzGY=
|
||||
github.com/uptrace/bun v1.1.15 h1:uxLNIo1VN8pkJ8rykwPBd9qYg4NDTvjHIintnwoQ3QY=
|
||||
github.com/uptrace/bun v1.1.15/go.mod h1:7HnsMRRvpLFUcquJxp22JO8PsWKpFQO/gNXqqsuGWg8=
|
||||
github.com/uptrace/bun/dialect/pgdialect v1.1.15 h1:fLmWvUPNqOhnZxJ4IqypXOQGxmXQJr1ISaIscRddPPY=
|
||||
github.com/uptrace/bun/dialect/pgdialect v1.1.15/go.mod h1:777qGnrISxHQ+Ulj5YbmmwywfQLLmIYJIoCbGZ+M7lY=
|
||||
github.com/uptrace/bun/dialect/sqlitedialect v1.1.15 h1:uZqBNm4iJnDO4mZ1UXUzGqMhjxB5SAsafMF58s2gmkQ=
|
||||
github.com/uptrace/bun/dialect/sqlitedialect v1.1.15/go.mod h1:ymLR6ladQrWS7eYTX45+lTIK7vocXiE3jXNBxUZMJlU=
|
||||
github.com/uptrace/bun/extra/bunotel v1.1.15 h1:ulzA0UqqMmTXsu7M0F23VGIdY1gFyLxgZhlAZwPMHXE=
|
||||
github.com/uptrace/bun/extra/bunotel v1.1.15/go.mod h1:nOsIf8xAROpI5ZbiO9Ys/fE2wJB23wMBBrH8XsVhEJk=
|
||||
github.com/uptrace/opentelemetry-go-extra/otelsql v0.2.2 h1:USRngIQppxeyb39XzkVHXwQesKK0+JSwnHE/1c7fgic=
|
||||
github.com/uptrace/opentelemetry-go-extra/otelsql v0.2.2/go.mod h1:1frv9RN1rlTq0jzCq+mVuEQisubZCQ4OU6S/8CaHzGY=
|
||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasthttp v1.14.0/go.mod h1:ol1PCaL0dX20wC0htZ7sYCsvCYmrouYra0zHzaclZhE=
|
||||
|
|
20
vendor/github.com/uptrace/bun/CHANGELOG.md
generated
vendored
20
vendor/github.com/uptrace/bun/CHANGELOG.md
generated
vendored
|
@ -1,3 +1,23 @@
|
|||
## [1.1.15](https://github.com/uptrace/bun/compare/v1.1.14...v1.1.15) (2023-09-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* "model does not have column" error ([#850](https://github.com/uptrace/bun/issues/850)) ([16367aa](https://github.com/uptrace/bun/commit/16367aabb34b98766d28e0678f9d47710f451fae))
|
||||
* alloc when mounting ([#891](https://github.com/uptrace/bun/issues/891)) ([f2256f1](https://github.com/uptrace/bun/commit/f2256f10a1d328fb924ca79cde76e77641398573))
|
||||
* index hints have to be specified following a table name ([4a2ae85](https://github.com/uptrace/bun/commit/4a2ae853a1509bb300bc2d96471505caee799e43))
|
||||
* make Rows.Close to drain messages ([5ceba07](https://github.com/uptrace/bun/commit/5ceba076668eb7aaddb1d8a56202256d5e6c1ead))
|
||||
* run hooks on Rows ([#892](https://github.com/uptrace/bun/issues/892)) ([f652b3d](https://github.com/uptrace/bun/commit/f652b3d399a3dc46c856eb8c0f10140a12ea4310))
|
||||
* scan error [#709](https://github.com/uptrace/bun/issues/709) ([#837](https://github.com/uptrace/bun/issues/837)) ([b82afa5](https://github.com/uptrace/bun/commit/b82afa52633b2a1b352db6de4ff0d369d5468a07))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add bun.NullZero ([786bb6b](https://github.com/uptrace/bun/commit/786bb6bfeba3c12f8b28579d61e4794d9fb3e373))
|
||||
* **bunotel:** add options for set otel providers ([#836](https://github.com/uptrace/bun/issues/836)) ([806e632](https://github.com/uptrace/bun/commit/806e6323f60b4703b03a71c113c263d0afc95b35))
|
||||
|
||||
|
||||
|
||||
## [1.1.14](https://github.com/uptrace/bun/compare/v1.1.13...v1.1.14) (2023-05-24)
|
||||
|
||||
|
||||
|
|
5
vendor/github.com/uptrace/bun/bun.go
generated
vendored
5
vendor/github.com/uptrace/bun/bun.go
generated
vendored
|
@ -10,6 +10,7 @@
|
|||
type (
|
||||
Safe = schema.Safe
|
||||
Ident = schema.Ident
|
||||
Name = schema.Name
|
||||
|
||||
NullTime = schema.NullTime
|
||||
BaseModel = schema.BaseModel
|
||||
|
@ -82,3 +83,7 @@ func SetLogger(logger internal.Logging) {
|
|||
func In(slice interface{}) schema.QueryAppender {
|
||||
return schema.In(slice)
|
||||
}
|
||||
|
||||
func NullZero(value interface{}) schema.QueryAppender {
|
||||
return schema.NullZero(value)
|
||||
}
|
||||
|
|
25
vendor/github.com/uptrace/bun/dialect/append.go
generated
vendored
25
vendor/github.com/uptrace/bun/dialect/append.go
generated
vendored
|
@ -48,14 +48,31 @@ func appendFloat(b []byte, v float64, bitSize int) []byte {
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
func AppendIdent(b []byte, field string, quote byte) []byte {
|
||||
return appendIdent(b, internal.Bytes(field), quote)
|
||||
func AppendName(b []byte, ident string, quote byte) []byte {
|
||||
return appendName(b, internal.Bytes(ident), quote)
|
||||
}
|
||||
|
||||
func appendIdent(b, src []byte, quote byte) []byte {
|
||||
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 src {
|
||||
for _, c := range name {
|
||||
switch c {
|
||||
case '*':
|
||||
if !quoted {
|
||||
|
|
2
vendor/github.com/uptrace/bun/dialect/pgdialect/version.go
generated
vendored
2
vendor/github.com/uptrace/bun/dialect/pgdialect/version.go
generated
vendored
|
@ -2,5 +2,5 @@
|
|||
|
||||
// Version is the current release version.
|
||||
func Version() string {
|
||||
return "1.1.14"
|
||||
return "1.1.15"
|
||||
}
|
||||
|
|
2
vendor/github.com/uptrace/bun/dialect/sqlitedialect/version.go
generated
vendored
2
vendor/github.com/uptrace/bun/dialect/sqlitedialect/version.go
generated
vendored
|
@ -2,5 +2,5 @@
|
|||
|
||||
// Version is the current release version.
|
||||
func Version() string {
|
||||
return "1.1.14"
|
||||
return "1.1.15"
|
||||
}
|
||||
|
|
22
vendor/github.com/uptrace/bun/extra/bunotel/option.go
generated
vendored
22
vendor/github.com/uptrace/bun/extra/bunotel/option.go
generated
vendored
|
@ -2,7 +2,9 @@
|
|||
|
||||
import (
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.12.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
type Option func(h *QueryHook)
|
||||
|
@ -30,3 +32,23 @@ func WithFormattedQueries(format bool) Option {
|
|||
h.formatQueries = format
|
||||
}
|
||||
}
|
||||
|
||||
// WithTracerProvider returns an Option to use the TracerProvider when
|
||||
// creating a Tracer.
|
||||
func WithTracerProvider(tp trace.TracerProvider) Option {
|
||||
return func(h *QueryHook) {
|
||||
if tp != nil {
|
||||
h.tracer = tp.Tracer("github.com/uptrace/bun")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WithMeterProvider returns an Option to use the MeterProvider when
|
||||
// creating a Meter.
|
||||
func WithMeterProvider(mp metric.MeterProvider) Option {
|
||||
return func(h *QueryHook) {
|
||||
if mp != nil {
|
||||
h.meter = mp.Meter("github.com/uptrace/bun")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
33
vendor/github.com/uptrace/bun/extra/bunotel/otel.go
generated
vendored
33
vendor/github.com/uptrace/bun/extra/bunotel/otel.go
generated
vendored
|
@ -20,20 +20,12 @@
|
|||
"github.com/uptrace/opentelemetry-go-extra/otelsql"
|
||||
)
|
||||
|
||||
var (
|
||||
tracer = otel.Tracer("github.com/uptrace/bun")
|
||||
meter = otel.Meter("github.com/uptrace/bun")
|
||||
|
||||
queryHistogram, _ = meter.Int64Histogram(
|
||||
"go.sql.query_timing",
|
||||
metric.WithDescription("Timing of processed queries"),
|
||||
metric.WithUnit("milliseconds"),
|
||||
)
|
||||
)
|
||||
|
||||
type QueryHook struct {
|
||||
attrs []attribute.KeyValue
|
||||
formatQueries bool
|
||||
attrs []attribute.KeyValue
|
||||
formatQueries bool
|
||||
tracer trace.Tracer
|
||||
meter metric.Meter
|
||||
queryHistogram metric.Int64Histogram
|
||||
}
|
||||
|
||||
var _ bun.QueryHook = (*QueryHook)(nil)
|
||||
|
@ -43,6 +35,17 @@ func NewQueryHook(opts ...Option) *QueryHook {
|
|||
for _, opt := range opts {
|
||||
opt(h)
|
||||
}
|
||||
if h.tracer == nil {
|
||||
h.tracer = otel.Tracer("github.com/uptrace/bun")
|
||||
}
|
||||
if h.meter == nil {
|
||||
h.meter = otel.Meter("github.com/uptrace/bun")
|
||||
}
|
||||
h.queryHistogram, _ = h.meter.Int64Histogram(
|
||||
"go.sql.query_timing",
|
||||
metric.WithDescription("Timing of processed queries"),
|
||||
metric.WithUnit("milliseconds"),
|
||||
)
|
||||
return h
|
||||
}
|
||||
|
||||
|
@ -57,7 +60,7 @@ func (h *QueryHook) Init(db *bun.DB) {
|
|||
}
|
||||
|
||||
func (h *QueryHook) BeforeQuery(ctx context.Context, event *bun.QueryEvent) context.Context {
|
||||
ctx, _ = tracer.Start(ctx, "", trace.WithSpanKind(trace.SpanKindClient))
|
||||
ctx, _ = h.tracer.Start(ctx, "", trace.WithSpanKind(trace.SpanKindClient))
|
||||
return ctx
|
||||
}
|
||||
|
||||
|
@ -75,7 +78,7 @@ func (h *QueryHook) AfterQuery(ctx context.Context, event *bun.QueryEvent) {
|
|||
}
|
||||
|
||||
dur := time.Since(event.StartTime)
|
||||
queryHistogram.Record(ctx, dur.Milliseconds(), metric.WithAttributes(labels...))
|
||||
h.queryHistogram.Record(ctx, dur.Milliseconds(), metric.WithAttributes(labels...))
|
||||
|
||||
span := trace.SpanFromContext(ctx)
|
||||
if !span.IsRecording() {
|
||||
|
|
24
vendor/github.com/uptrace/bun/internal/util.go
generated
vendored
24
vendor/github.com/uptrace/bun/internal/util.go
generated
vendored
|
@ -55,3 +55,27 @@ func Unwrap(err error) error {
|
|||
}
|
||||
return u.Unwrap()
|
||||
}
|
||||
|
||||
func FieldByIndexAlloc(v reflect.Value, index []int) reflect.Value {
|
||||
if len(index) == 1 {
|
||||
return v.Field(index[0])
|
||||
}
|
||||
|
||||
for i, idx := range index {
|
||||
if i > 0 {
|
||||
v = indirectNil(v)
|
||||
}
|
||||
v = v.Field(idx)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func indirectNil(v reflect.Value) reflect.Value {
|
||||
if v.Kind() == reflect.Ptr {
|
||||
if v.IsNil() {
|
||||
v.Set(reflect.New(v.Type().Elem()))
|
||||
}
|
||||
v = v.Elem()
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
|
3
vendor/github.com/uptrace/bun/model_table_struct.go
generated
vendored
3
vendor/github.com/uptrace/bun/model_table_struct.go
generated
vendored
|
@ -8,6 +8,7 @@
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/uptrace/bun/internal"
|
||||
"github.com/uptrace/bun/schema"
|
||||
)
|
||||
|
||||
|
@ -234,7 +235,7 @@ func (m *structTableModel) parentIndex() []int {
|
|||
}
|
||||
|
||||
func (m *structTableModel) mount(host reflect.Value) {
|
||||
m.strct = host.FieldByIndex(m.rel.Field.Index)
|
||||
m.strct = internal.FieldByIndexAlloc(host, m.rel.Field.Index)
|
||||
m.structInited = false
|
||||
}
|
||||
|
||||
|
|
2
vendor/github.com/uptrace/bun/package.json
generated
vendored
2
vendor/github.com/uptrace/bun/package.json
generated
vendored
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "gobun",
|
||||
"version": "1.1.14",
|
||||
"version": "1.1.15",
|
||||
"main": "index.js",
|
||||
"repository": "git@github.com:uptrace/bun.git",
|
||||
"author": "Vladimir Mihailenco <vladimir.webdev@gmail.com>",
|
||||
|
|
2
vendor/github.com/uptrace/bun/query_base.go
generated
vendored
2
vendor/github.com/uptrace/bun/query_base.go
generated
vendored
|
@ -588,7 +588,7 @@ func (q *baseQuery) exec(
|
|||
) (sql.Result, error) {
|
||||
ctx, event := q.db.beforeQuery(ctx, iquery, query, nil, query, q.model)
|
||||
res, err := q.conn.ExecContext(ctx, query)
|
||||
q.db.afterQuery(ctx, event, nil, err)
|
||||
q.db.afterQuery(ctx, event, res, err)
|
||||
return res, err
|
||||
}
|
||||
|
||||
|
|
16
vendor/github.com/uptrace/bun/query_select.go
generated
vendored
16
vendor/github.com/uptrace/bun/query_select.go
generated
vendored
|
@ -551,6 +551,11 @@ func (q *SelectQuery) appendQuery(
|
|||
}
|
||||
}
|
||||
|
||||
b, err = q.appendIndexHints(fmter, b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := q.forEachInlineRelJoin(func(j *relationJoin) error {
|
||||
b = append(b, ' ')
|
||||
b, err = j.appendHasOneJoin(fmter, b, q)
|
||||
|
@ -566,11 +571,6 @@ func (q *SelectQuery) appendQuery(
|
|||
}
|
||||
}
|
||||
|
||||
b, err = q.appendIndexHints(fmter, b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
b, err = q.appendWhere(fmter, b, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -813,7 +813,11 @@ func (q *SelectQuery) Rows(ctx context.Context) (*sql.Rows, error) {
|
|||
}
|
||||
|
||||
query := internal.String(queryBytes)
|
||||
return q.conn.QueryContext(ctx, query)
|
||||
|
||||
ctx, event := q.db.beforeQuery(ctx, q, query, nil, query, q.model)
|
||||
rows, err := q.conn.QueryContext(ctx, query)
|
||||
q.db.afterQuery(ctx, event, nil, err)
|
||||
return rows, err
|
||||
}
|
||||
|
||||
func (q *SelectQuery) Exec(ctx context.Context, dest ...interface{}) (res sql.Result, err error) {
|
||||
|
|
8
vendor/github.com/uptrace/bun/query_update.go
generated
vendored
8
vendor/github.com/uptrace/bun/query_update.go
generated
vendored
|
@ -271,10 +271,18 @@ func (q *UpdateQuery) mustAppendSet(fmter schema.Formatter, b []byte) (_ []byte,
|
|||
|
||||
switch model := q.tableModel.(type) {
|
||||
case *structTableModel:
|
||||
pos := len(b)
|
||||
b, err = q.appendSetStruct(fmter, b, model)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Validate if no values were appended after SET clause.
|
||||
// e.g. UPDATE users SET WHERE id = 1
|
||||
// See issues858
|
||||
if len(b) == pos {
|
||||
return nil, errors.New("bun: empty SET clause is not allowed in the UPDATE query")
|
||||
}
|
||||
case *sliceTableModel:
|
||||
return nil, errors.New("bun: to bulk Update, use CTE and VALUES")
|
||||
default:
|
||||
|
|
7
vendor/github.com/uptrace/bun/relation_join.go
generated
vendored
7
vendor/github.com/uptrace/bun/relation_join.go
generated
vendored
|
@ -178,7 +178,12 @@ func (j *relationJoin) m2mQuery(q *SelectQuery) *SelectQuery {
|
|||
baseTable := j.BaseModel.Table()
|
||||
|
||||
if j.Relation.M2MTable != nil {
|
||||
q = q.ColumnExpr(string(j.Relation.M2MTable.SQLAlias) + ".*")
|
||||
fields := append(j.Relation.M2MBaseFields, j.Relation.M2MJoinFields...)
|
||||
|
||||
b := make([]byte, 0, len(fields))
|
||||
b = appendColumns(b, j.Relation.M2MTable.SQLAlias, fields)
|
||||
|
||||
q = q.ColumnExpr(internal.String(b))
|
||||
}
|
||||
|
||||
//nolint
|
||||
|
|
21
vendor/github.com/uptrace/bun/schema/append.go
generated
vendored
21
vendor/github.com/uptrace/bun/schema/append.go
generated
vendored
|
@ -81,7 +81,7 @@ func appendIn(fmter Formatter, b []byte, slice reflect.Value) []byte {
|
|||
sliceLen := slice.Len()
|
||||
|
||||
if sliceLen == 0 {
|
||||
return append(b, "NULL"...)
|
||||
return dialect.AppendNull(b)
|
||||
}
|
||||
|
||||
for i := 0; i < sliceLen; i++ {
|
||||
|
@ -104,3 +104,22 @@ func appendIn(fmter Formatter, b []byte, slice reflect.Value) []byte {
|
|||
}
|
||||
return b
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
func NullZero(value interface{}) QueryAppender {
|
||||
return nullZero{
|
||||
value: value,
|
||||
}
|
||||
}
|
||||
|
||||
type nullZero struct {
|
||||
value interface{}
|
||||
}
|
||||
|
||||
func (nz nullZero) AppendQuery(fmter Formatter, b []byte) (_ []byte, err error) {
|
||||
if isZero(nz.value) {
|
||||
return dialect.AppendNull(b), nil
|
||||
}
|
||||
return fmter.AppendValue(b, reflect.ValueOf(nz.value)), nil
|
||||
}
|
||||
|
|
5
vendor/github.com/uptrace/bun/schema/field.go
generated
vendored
5
vendor/github.com/uptrace/bun/schema/field.go
generated
vendored
|
@ -5,6 +5,7 @@
|
|||
"reflect"
|
||||
|
||||
"github.com/uptrace/bun/dialect"
|
||||
"github.com/uptrace/bun/internal"
|
||||
"github.com/uptrace/bun/internal/tagparser"
|
||||
)
|
||||
|
||||
|
@ -50,7 +51,7 @@ func (f *Field) Clone() *Field {
|
|||
}
|
||||
|
||||
func (f *Field) Value(strct reflect.Value) reflect.Value {
|
||||
return fieldByIndexAlloc(strct, f.Index)
|
||||
return internal.FieldByIndexAlloc(strct, f.Index)
|
||||
}
|
||||
|
||||
func (f *Field) HasNilValue(v reflect.Value) bool {
|
||||
|
@ -117,7 +118,7 @@ func (f *Field) ScanValue(strct reflect.Value, src interface{}) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
fv := fieldByIndexAlloc(strct, f.Index)
|
||||
fv := internal.FieldByIndexAlloc(strct, f.Index)
|
||||
return f.ScanWithCheck(fv, src)
|
||||
}
|
||||
|
||||
|
|
4
vendor/github.com/uptrace/bun/schema/formatter.go
generated
vendored
4
vendor/github.com/uptrace/bun/schema/formatter.go
generated
vendored
|
@ -42,6 +42,10 @@ func (f Formatter) IdentQuote() byte {
|
|||
return f.dialect.IdentQuote()
|
||||
}
|
||||
|
||||
func (f Formatter) AppendName(b []byte, name string) []byte {
|
||||
return dialect.AppendName(b, name, f.IdentQuote())
|
||||
}
|
||||
|
||||
func (f Formatter) AppendIdent(b []byte, ident string) []byte {
|
||||
return dialect.AppendIdent(b, ident, f.IdentQuote())
|
||||
}
|
||||
|
|
24
vendor/github.com/uptrace/bun/schema/reflect.go
generated
vendored
24
vendor/github.com/uptrace/bun/schema/reflect.go
generated
vendored
|
@ -46,27 +46,3 @@ func fieldByIndex(v reflect.Value, index []int) (_ reflect.Value, ok bool) {
|
|||
}
|
||||
return v, true
|
||||
}
|
||||
|
||||
func fieldByIndexAlloc(v reflect.Value, index []int) reflect.Value {
|
||||
if len(index) == 1 {
|
||||
return v.Field(index[0])
|
||||
}
|
||||
|
||||
for i, idx := range index {
|
||||
if i > 0 {
|
||||
v = indirectNil(v)
|
||||
}
|
||||
v = v.Field(idx)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func indirectNil(v reflect.Value) reflect.Value {
|
||||
if v.Kind() == reflect.Ptr {
|
||||
if v.IsNil() {
|
||||
v.Set(reflect.New(v.Type().Elem()))
|
||||
}
|
||||
v = v.Elem()
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
|
14
vendor/github.com/uptrace/bun/schema/sqlfmt.go
generated
vendored
14
vendor/github.com/uptrace/bun/schema/sqlfmt.go
generated
vendored
|
@ -27,7 +27,19 @@ func (s Safe) AppendQuery(fmter Formatter, b []byte) ([]byte, error) {
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Ident represents a SQL identifier, for example, table or column name.
|
||||
// Name represents a single SQL name, for example, a column name.
|
||||
type Name string
|
||||
|
||||
var _ QueryAppender = (*Name)(nil)
|
||||
|
||||
func (s Name) AppendQuery(fmter Formatter, b []byte) ([]byte, error) {
|
||||
return fmter.AppendName(b, string(s)), nil
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Ident represents a SQL identifier, for example,
|
||||
// a fully qualified column name such as `table_name.col_name`.
|
||||
type Ident string
|
||||
|
||||
var _ QueryAppender = (*Ident)(nil)
|
||||
|
|
39
vendor/github.com/uptrace/bun/schema/table.go
generated
vendored
39
vendor/github.com/uptrace/bun/schema/table.go
generated
vendored
|
@ -4,6 +4,7 @@
|
|||
"database/sql"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -806,18 +807,38 @@ func (t *Table) m2mRelation(field *Field) *Relation {
|
|||
return rel
|
||||
}
|
||||
|
||||
func (t *Table) inlineFields(field *Field, seen map[reflect.Type]struct{}) {
|
||||
if seen == nil {
|
||||
seen = map[reflect.Type]struct{}{t.Type: {}}
|
||||
}
|
||||
type seenKey struct {
|
||||
Table reflect.Type
|
||||
FieldIndex string
|
||||
}
|
||||
|
||||
if _, ok := seen[field.IndirectType]; ok {
|
||||
return
|
||||
type seenMap map[seenKey]struct{}
|
||||
|
||||
func NewSeenKey(table reflect.Type, fieldIndex []int) (key seenKey) {
|
||||
key.Table = table
|
||||
for _, index := range fieldIndex {
|
||||
key.FieldIndex += strconv.Itoa(index) + "-"
|
||||
}
|
||||
return key
|
||||
}
|
||||
|
||||
func (s seenMap) Clone() seenMap {
|
||||
t := make(seenMap)
|
||||
for k, v := range s {
|
||||
t[k] = v
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
func (t *Table) inlineFields(field *Field, seen seenMap) {
|
||||
if seen == nil {
|
||||
seen = make(seenMap)
|
||||
}
|
||||
seen[field.IndirectType] = struct{}{}
|
||||
|
||||
joinTable := t.dialect.Tables().Ref(field.IndirectType)
|
||||
for _, f := range joinTable.allFields {
|
||||
key := NewSeenKey(joinTable.Type, f.Index)
|
||||
|
||||
f = f.Clone()
|
||||
f.GoName = field.GoName + "_" + f.GoName
|
||||
f.Name = field.Name + "__" + f.Name
|
||||
|
@ -834,7 +855,9 @@ func (t *Table) inlineFields(field *Field, seen map[reflect.Type]struct{}) {
|
|||
continue
|
||||
}
|
||||
|
||||
if _, ok := seen[f.IndirectType]; !ok {
|
||||
if _, ok := seen[key]; !ok {
|
||||
seen = seen.Clone()
|
||||
seen[key] = struct{}{}
|
||||
t.inlineFields(f, seen)
|
||||
}
|
||||
}
|
||||
|
|
39
vendor/github.com/uptrace/bun/schema/zerochecker.go
generated
vendored
39
vendor/github.com/uptrace/bun/schema/zerochecker.go
generated
vendored
|
@ -11,6 +11,45 @@ type isZeroer interface {
|
|||
IsZero() bool
|
||||
}
|
||||
|
||||
func isZero(v interface{}) bool {
|
||||
switch v := v.(type) {
|
||||
case isZeroer:
|
||||
return v.IsZero()
|
||||
case string:
|
||||
return v == ""
|
||||
case []byte:
|
||||
return v == nil
|
||||
case int:
|
||||
return v == 0
|
||||
case int64:
|
||||
return v == 0
|
||||
case uint:
|
||||
return v == 0
|
||||
case uint64:
|
||||
return v == 0
|
||||
case float32:
|
||||
return v == 0
|
||||
case float64:
|
||||
return v == 0
|
||||
case int8:
|
||||
return v == 0
|
||||
case int16:
|
||||
return v == 0
|
||||
case int32:
|
||||
return v == 0
|
||||
case uint8:
|
||||
return v == 0
|
||||
case uint16:
|
||||
return v == 0
|
||||
case uint32:
|
||||
return v == 0
|
||||
default:
|
||||
rv := reflect.ValueOf(v)
|
||||
fn := zeroChecker(rv.Type())
|
||||
return fn(rv)
|
||||
}
|
||||
}
|
||||
|
||||
type IsZeroerFunc func(reflect.Value) bool
|
||||
|
||||
func zeroChecker(typ reflect.Type) IsZeroerFunc {
|
||||
|
|
2
vendor/github.com/uptrace/bun/version.go
generated
vendored
2
vendor/github.com/uptrace/bun/version.go
generated
vendored
|
@ -2,5 +2,5 @@
|
|||
|
||||
// Version is the current release version.
|
||||
func Version() string {
|
||||
return "1.1.14"
|
||||
return "1.1.15"
|
||||
}
|
||||
|
|
2
vendor/github.com/uptrace/opentelemetry-go-extra/otelsql/README.md
generated
vendored
2
vendor/github.com/uptrace/opentelemetry-go-extra/otelsql/README.md
generated
vendored
|
@ -2,7 +2,7 @@
|
|||
|
||||
# database/sql instrumentation for OpenTelemetry Go
|
||||
|
||||
[database/sql OpenTelemetry instrumentation](https://uptrace.dev/opentelemetry/instrumentations/go-database-sql.html)
|
||||
[database/sql OpenTelemetry instrumentation](https://uptrace.dev/getinstrument/opentelemetry-database-sql.html)
|
||||
records database queries (including `Tx` and `Stmt` queries) and reports `DBStats` metrics.
|
||||
|
||||
## Installation
|
||||
|
|
2
vendor/github.com/uptrace/opentelemetry-go-extra/otelsql/version.go
generated
vendored
2
vendor/github.com/uptrace/opentelemetry-go-extra/otelsql/version.go
generated
vendored
|
@ -2,5 +2,5 @@
|
|||
|
||||
// Version is the current release version.
|
||||
func Version() string {
|
||||
return "0.2.1"
|
||||
return "0.2.2"
|
||||
}
|
||||
|
|
10
vendor/modules.txt
vendored
10
vendor/modules.txt
vendored
|
@ -699,7 +699,7 @@ github.com/ugorji/go/codec
|
|||
github.com/ulule/limiter/v3
|
||||
github.com/ulule/limiter/v3/drivers/store/common
|
||||
github.com/ulule/limiter/v3/drivers/store/memory
|
||||
# github.com/uptrace/bun v1.1.14
|
||||
# github.com/uptrace/bun v1.1.15
|
||||
## explicit; go 1.19
|
||||
github.com/uptrace/bun
|
||||
github.com/uptrace/bun/dialect
|
||||
|
@ -711,16 +711,16 @@ github.com/uptrace/bun/internal/parser
|
|||
github.com/uptrace/bun/internal/tagparser
|
||||
github.com/uptrace/bun/migrate
|
||||
github.com/uptrace/bun/schema
|
||||
# github.com/uptrace/bun/dialect/pgdialect v1.1.14
|
||||
# github.com/uptrace/bun/dialect/pgdialect v1.1.15
|
||||
## explicit; go 1.19
|
||||
github.com/uptrace/bun/dialect/pgdialect
|
||||
# github.com/uptrace/bun/dialect/sqlitedialect v1.1.14
|
||||
# github.com/uptrace/bun/dialect/sqlitedialect v1.1.15
|
||||
## explicit; go 1.19
|
||||
github.com/uptrace/bun/dialect/sqlitedialect
|
||||
# github.com/uptrace/bun/extra/bunotel v1.1.14
|
||||
# github.com/uptrace/bun/extra/bunotel v1.1.15
|
||||
## explicit; go 1.19
|
||||
github.com/uptrace/bun/extra/bunotel
|
||||
# github.com/uptrace/opentelemetry-go-extra/otelsql v0.2.1
|
||||
# github.com/uptrace/opentelemetry-go-extra/otelsql v0.2.2
|
||||
## explicit; go 1.18
|
||||
github.com/uptrace/opentelemetry-go-extra/otelsql
|
||||
# github.com/vmihailenco/msgpack/v5 v5.3.5
|
||||
|
|
Loading…
Reference in a new issue