diff options
| author | 2025-07-18 11:56:40 +0200 | |
|---|---|---|
| committer | 2025-07-18 11:56:40 +0200 | |
| commit | eb600819854039c8d89fb1d7000f301ad3c7d542 (patch) | |
| tree | 267138dcdf3280e32ef4dde7b5a3355212bd0474 /vendor/github.com | |
| parent | [feature] Add `avif` file support (#4331) (diff) | |
| download | gotosocial-eb600819854039c8d89fb1d7000f301ad3c7d542.tar.xz | |
[chore/deps] Upgrade to go-sqlite 0.27.1 (#4334)
# Description
This brings some performance improvements and SQLite 3.50.3.
## Checklist
Please put an x inside each checkbox to indicate that you've read and followed it: `[ ]` -> `[x]`
If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).
- [x] I/we have read the [GoToSocial contribution guidelines](https://codeberg.org/superseriousbusiness/gotosocial/src/branch/main/CONTRIBUTING.md).
- [ ] I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
- [x] I/we have not leveraged AI to create the proposed changes.
- [ ] I/we have performed a self-review of added code.
- [ ] I/we have written code that is legible and maintainable by others.
- [ ] I/we have commented the added code, particularly in hard-to-understand areas.
- [ ] I/we have made any necessary changes to documentation.
- [ ] I/we have added tests that cover new code.
- [x] I/we have run tests and they pass locally with the changes.
- [ ] I/we have run `go fmt ./...` and `golangci-lint run`.
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4334
Co-authored-by: Daenney <git@noreply.sourcery.dny.nu>
Co-committed-by: Daenney <git@noreply.sourcery.dny.nu>
Diffstat (limited to 'vendor/github.com')
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/const.go | 12 | ||||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/context.go | 8 | ||||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/driver/driver.go | 6 | ||||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/embed/README.md | 2 | ||||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/embed/exports.txt | 2 | ||||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm | bin | 1398675 -> 1398735 bytes | |||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/internal/util/pointer.go | 10 | ||||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/pointer.go | 4 | ||||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/stmt.go | 1 | ||||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm | bin | 15969 -> 15960 bytes | |||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/value.go | 42 | ||||
| -rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/vfs/memdb/memdb.go | 31 |
12 files changed, 59 insertions, 59 deletions
diff --git a/vendor/github.com/ncruces/go-sqlite3/const.go b/vendor/github.com/ncruces/go-sqlite3/const.go index e4fc8297c..4a4dfeb2f 100644 --- a/vendor/github.com/ncruces/go-sqlite3/const.go +++ b/vendor/github.com/ncruces/go-sqlite3/const.go @@ -185,12 +185,12 @@ const ( type FunctionFlag uint32 const ( - DETERMINISTIC FunctionFlag = 0x000000800 - DIRECTONLY FunctionFlag = 0x000080000 - INNOCUOUS FunctionFlag = 0x000200000 - SELFORDER1 FunctionFlag = 0x002000000 - // SUBTYPE FunctionFlag = 0x000100000 - // RESULT_SUBTYPE FunctionFlag = 0x001000000 + DETERMINISTIC FunctionFlag = 0x000000800 + DIRECTONLY FunctionFlag = 0x000080000 + SUBTYPE FunctionFlag = 0x000100000 + INNOCUOUS FunctionFlag = 0x000200000 + RESULT_SUBTYPE FunctionFlag = 0x001000000 + SELFORDER1 FunctionFlag = 0x002000000 ) // StmtStatus name counter values associated with the [Stmt.Status] method. diff --git a/vendor/github.com/ncruces/go-sqlite3/context.go b/vendor/github.com/ncruces/go-sqlite3/context.go index 7caf58626..154c228cf 100644 --- a/vendor/github.com/ncruces/go-sqlite3/context.go +++ b/vendor/github.com/ncruces/go-sqlite3/context.go @@ -227,6 +227,14 @@ func (ctx Context) ResultError(err error) { } } +// ResultSubtype sets the subtype of the result of the function. +// +// https://sqlite.org/c3ref/result_subtype.html +func (ctx Context) ResultSubtype(t uint) { + ctx.c.call("sqlite3_result_subtype", + stk_t(ctx.handle), stk_t(uint32(t))) +} + // VTabNoChange may return true if a column is being fetched as part // of an update during which the column value will not change. // diff --git a/vendor/github.com/ncruces/go-sqlite3/driver/driver.go b/vendor/github.com/ncruces/go-sqlite3/driver/driver.go index f473220c0..280611f71 100644 --- a/vendor/github.com/ncruces/go-sqlite3/driver/driver.go +++ b/vendor/github.com/ncruces/go-sqlite3/driver/driver.go @@ -546,8 +546,8 @@ func (s *stmt) setupBindings(args []driver.NamedValue) (err error) { err = s.Stmt.BindTime(id, a, s.tmWrite) case util.JSON: err = s.Stmt.BindJSON(id, a.Value) - case util.PointerUnwrap: - err = s.Stmt.BindPointer(id, util.UnwrapPointer(a)) + case util.Pointer: + err = s.Stmt.BindPointer(id, a.Value) case nil: err = s.Stmt.BindNull(id) default: @@ -565,7 +565,7 @@ func (s *stmt) CheckNamedValue(arg *driver.NamedValue) error { switch arg.Value.(type) { case bool, int, int64, float64, string, []byte, time.Time, sqlite3.ZeroBlob, - util.JSON, util.PointerUnwrap, + util.JSON, util.Pointer, nil: return nil default: diff --git a/vendor/github.com/ncruces/go-sqlite3/embed/README.md b/vendor/github.com/ncruces/go-sqlite3/embed/README.md index 0adf617dc..346a4e308 100644 --- a/vendor/github.com/ncruces/go-sqlite3/embed/README.md +++ b/vendor/github.com/ncruces/go-sqlite3/embed/README.md @@ -1,6 +1,6 @@ # Embeddable Wasm build of SQLite -This folder includes an embeddable Wasm build of SQLite 3.50.2 for use with +This folder includes an embeddable Wasm build of SQLite 3.50.3 for use with [`github.com/ncruces/go-sqlite3`](https://pkg.go.dev/github.com/ncruces/go-sqlite3). The following optional features are compiled in: diff --git a/vendor/github.com/ncruces/go-sqlite3/embed/exports.txt b/vendor/github.com/ncruces/go-sqlite3/embed/exports.txt index 1de4b3382..bb049c219 100644 --- a/vendor/github.com/ncruces/go-sqlite3/embed/exports.txt +++ b/vendor/github.com/ncruces/go-sqlite3/embed/exports.txt @@ -98,6 +98,7 @@ sqlite3_result_error_toobig sqlite3_result_int64 sqlite3_result_null sqlite3_result_pointer_go +sqlite3_result_subtype sqlite3_result_text_go sqlite3_result_value sqlite3_result_zeroblob64 @@ -126,6 +127,7 @@ sqlite3_value_int64 sqlite3_value_nochange sqlite3_value_numeric_type sqlite3_value_pointer_go +sqlite3_value_subtype sqlite3_value_text sqlite3_value_type sqlite3_vtab_collation diff --git a/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm b/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm Binary files differindex 7ad7f746d..dac29da3d 100644 --- a/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm +++ b/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm diff --git a/vendor/github.com/ncruces/go-sqlite3/internal/util/pointer.go b/vendor/github.com/ncruces/go-sqlite3/internal/util/pointer.go index eae4dae17..dbcfac362 100644 --- a/vendor/github.com/ncruces/go-sqlite3/internal/util/pointer.go +++ b/vendor/github.com/ncruces/go-sqlite3/internal/util/pointer.go @@ -1,11 +1,3 @@ package util -type Pointer[T any] struct{ Value T } - -func (p Pointer[T]) unwrap() any { return p.Value } - -type PointerUnwrap interface{ unwrap() any } - -func UnwrapPointer(p PointerUnwrap) any { - return p.unwrap() -} +type Pointer struct{ Value any } diff --git a/vendor/github.com/ncruces/go-sqlite3/pointer.go b/vendor/github.com/ncruces/go-sqlite3/pointer.go index 0e2418b99..245558f86 100644 --- a/vendor/github.com/ncruces/go-sqlite3/pointer.go +++ b/vendor/github.com/ncruces/go-sqlite3/pointer.go @@ -8,6 +8,6 @@ import "github.com/ncruces/go-sqlite3/internal/util" // [Value.Pointer], or [Context.ResultPointer]. // // https://sqlite.org/bindptr.html -func Pointer[T any](value T) any { - return util.Pointer[T]{Value: value} +func Pointer(value any) any { + return util.Pointer{Value: value} } diff --git a/vendor/github.com/ncruces/go-sqlite3/stmt.go b/vendor/github.com/ncruces/go-sqlite3/stmt.go index 363b45af2..706182f9f 100644 --- a/vendor/github.com/ncruces/go-sqlite3/stmt.go +++ b/vendor/github.com/ncruces/go-sqlite3/stmt.go @@ -631,7 +631,6 @@ func (s *Stmt) ColumnValue(col int) Value { stk_t(s.handle), stk_t(col))) return Value{ c: s.c, - unprot: true, handle: ptr, } } diff --git a/vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm b/vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm Binary files differindex fa8af14a0..f7dc0cdf4 100644 --- a/vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm +++ b/vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm diff --git a/vendor/github.com/ncruces/go-sqlite3/value.go b/vendor/github.com/ncruces/go-sqlite3/value.go index 6753027b5..54d8f21eb 100644 --- a/vendor/github.com/ncruces/go-sqlite3/value.go +++ b/vendor/github.com/ncruces/go-sqlite3/value.go @@ -15,15 +15,6 @@ import ( type Value struct { c *Conn handle ptr_t - unprot bool - copied bool -} - -func (v Value) protected() stk_t { - if v.unprot { - panic(util.ValueErr) - } - return stk_t(v.handle) } // Dup makes a copy of the SQL value and returns a pointer to that copy. @@ -33,7 +24,6 @@ func (v Value) Dup() *Value { ptr := ptr_t(v.c.call("sqlite3_value_dup", stk_t(v.handle))) return &Value{ c: v.c, - copied: true, handle: ptr, } } @@ -42,9 +32,6 @@ func (v Value) Dup() *Value { // // https://sqlite.org/c3ref/value_dup.html func (dup *Value) Close() error { - if !dup.copied { - panic(util.ValueErr) - } dup.c.call("sqlite3_value_free", stk_t(dup.handle)) dup.handle = 0 return nil @@ -54,14 +41,21 @@ func (dup *Value) Close() error { // // https://sqlite.org/c3ref/value_blob.html func (v Value) Type() Datatype { - return Datatype(v.c.call("sqlite3_value_type", v.protected())) + return Datatype(v.c.call("sqlite3_value_type", stk_t(v.handle))) +} + +// Subtype returns the subtype of the value. +// +// https://sqlite.org/c3ref/value_subtype.html +func (v Value) Subtype() uint { + return uint(uint32(v.c.call("sqlite3_value_subtype", stk_t(v.handle)))) } -// Type returns the numeric datatype of the value. +// NumericType returns the numeric datatype of the value. // // https://sqlite.org/c3ref/value_blob.html func (v Value) NumericType() Datatype { - return Datatype(v.c.call("sqlite3_value_numeric_type", v.protected())) + return Datatype(v.c.call("sqlite3_value_numeric_type", stk_t(v.handle))) } // Bool returns the value as a bool. @@ -85,14 +79,14 @@ func (v Value) Int() int { // // https://sqlite.org/c3ref/value_blob.html func (v Value) Int64() int64 { - return int64(v.c.call("sqlite3_value_int64", v.protected())) + return int64(v.c.call("sqlite3_value_int64", stk_t(v.handle))) } // Float returns the value as a float64. // // https://sqlite.org/c3ref/value_blob.html func (v Value) Float() float64 { - f := uint64(v.c.call("sqlite3_value_double", v.protected())) + f := uint64(v.c.call("sqlite3_value_double", stk_t(v.handle))) return math.Float64frombits(f) } @@ -138,7 +132,7 @@ func (v Value) Blob(buf []byte) []byte { // // https://sqlite.org/c3ref/value_blob.html func (v Value) RawText() []byte { - ptr := ptr_t(v.c.call("sqlite3_value_text", v.protected())) + ptr := ptr_t(v.c.call("sqlite3_value_text", stk_t(v.handle))) return v.rawBytes(ptr, 1) } @@ -148,7 +142,7 @@ func (v Value) RawText() []byte { // // https://sqlite.org/c3ref/value_blob.html func (v Value) RawBlob() []byte { - ptr := ptr_t(v.c.call("sqlite3_value_blob", v.protected())) + ptr := ptr_t(v.c.call("sqlite3_value_blob", stk_t(v.handle))) return v.rawBytes(ptr, 0) } @@ -157,14 +151,14 @@ func (v Value) rawBytes(ptr ptr_t, nul int32) []byte { return nil } - n := int32(v.c.call("sqlite3_value_bytes", v.protected())) + n := int32(v.c.call("sqlite3_value_bytes", stk_t(v.handle))) return util.View(v.c.mod, ptr, int64(n+nul))[:n] } // Pointer gets the pointer associated with this value, // or nil if it has no associated pointer. func (v Value) Pointer() any { - ptr := ptr_t(v.c.call("sqlite3_value_pointer_go", v.protected())) + ptr := ptr_t(v.c.call("sqlite3_value_pointer_go", stk_t(v.handle))) return util.GetHandle(v.c.ctx, ptr) } @@ -194,7 +188,7 @@ func (v Value) JSON(ptr any) error { // // https://sqlite.org/c3ref/value_blob.html func (v Value) NoChange() bool { - b := int32(v.c.call("sqlite3_value_nochange", v.protected())) + b := int32(v.c.call("sqlite3_value_nochange", stk_t(v.handle))) return b != 0 } @@ -202,7 +196,7 @@ func (v Value) NoChange() bool { // // https://sqlite.org/c3ref/value_blob.html func (v Value) FromBind() bool { - b := int32(v.c.call("sqlite3_value_frombind", v.protected())) + b := int32(v.c.call("sqlite3_value_frombind", stk_t(v.handle))) return b != 0 } diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/memdb/memdb.go b/vendor/github.com/ncruces/go-sqlite3/vfs/memdb/memdb.go index 94347f1cc..b99070496 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/memdb/memdb.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/memdb/memdb.go @@ -2,7 +2,6 @@ package memdb import ( "io" - "runtime" "sync" "time" @@ -85,9 +84,10 @@ type memDB struct { // +checklocks:memoryMtx refs int32 - shared int32 // +checklocks:lockMtx - pending bool // +checklocks:lockMtx - reserved bool // +checklocks:lockMtx + shared int32 // +checklocks:lockMtx + pending bool // +checklocks:lockMtx + reserved bool // +checklocks:lockMtx + waiter *sync.Cond // +checklocks:lockMtx lockMtx sync.Mutex dataMtx sync.RWMutex @@ -195,8 +195,6 @@ func (m *memFile) Size() (int64, error) { return m.size, nil } -const spinWait = 25 * time.Microsecond - func (m *memFile) Lock(lock vfs.LockLevel) error { if m.lock >= lock { return nil @@ -228,13 +226,18 @@ func (m *memFile) Lock(lock vfs.LockLevel) error { m.pending = true } - for before := time.Now(); m.shared > 1; { - if time.Since(before) > spinWait { - return sqlite3.BUSY + if m.shared > 1 { + before := time.Now() + if m.waiter == nil { + m.waiter = sync.NewCond(&m.lockMtx) + } + defer time.AfterFunc(time.Millisecond, m.waiter.Broadcast).Stop() + for m.shared > 1 { + if time.Since(before) > time.Millisecond { + return sqlite3.BUSY + } + m.waiter.Wait() } - m.lockMtx.Unlock() - runtime.Gosched() - m.lockMtx.Lock() } } @@ -257,7 +260,9 @@ func (m *memFile) Unlock(lock vfs.LockLevel) error { m.pending = false } if lock < vfs.LOCK_SHARED { - m.shared-- + if m.shared--; m.pending && m.shared <= 1 && m.waiter != nil { + m.waiter.Broadcast() + } } m.lock = lock return nil |
