diff options
author | 2025-03-09 17:47:56 +0100 | |
---|---|---|
committer | 2025-03-10 01:59:49 +0100 | |
commit | 3ac1ee16f377d31a0fb80c8dae28b6239ac4229e (patch) | |
tree | f61faa581feaaeaba2542b9f2b8234a590684413 /vendor/github.com/uptrace/bun/dialect/sqlitedialect | |
parent | [chore] update URLs to forked source (diff) | |
download | gotosocial-3ac1ee16f377d31a0fb80c8dae28b6239ac4229e.tar.xz |
[chore] remove vendor
Diffstat (limited to 'vendor/github.com/uptrace/bun/dialect/sqlitedialect')
3 files changed, 0 insertions, 178 deletions
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 1280d0d69..000000000 --- a/vendor/github.com/uptrace/bun/dialect/sqlitedialect/dialect.go +++ /dev/null @@ -1,148 +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(opts ...DialectOption) *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 | - feature.AutoIncrement | - feature.CompositeIn | - feature.DeleteReturning - - for _, opt := range opts { - opt(d) - } - - return d -} - -type DialectOption func(d *Dialect) - -func WithoutFeature(other feature.Feature) DialectOption { - return func(d *Dialect) { - d.features = d.features.Remove(other) - } -} - -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 (d *Dialect) DefaultVarcharLen() int { - return 0 -} - -// AppendSequence adds AUTOINCREMENT keyword to the column definition. As per [documentation], -// AUTOINCREMENT is only valid for INTEGER PRIMARY KEY, and this method will be a noop for other columns. -// -// Because this is a valid construct: -// -// CREATE TABLE ("id" INTEGER PRIMARY KEY AUTOINCREMENT); -// -// and this is not: -// -// CREATE TABLE ("id" INTEGER AUTOINCREMENT, PRIMARY KEY ("id")); -// -// AppendSequence adds a primary key constraint as a *side-effect*. Callers should expect it to avoid building invalid SQL. -// SQLite also [does not support] AUTOINCREMENT column in composite primary keys. -// -// [documentation]: https://www.sqlite.org/autoinc.html -// [does not support]: https://stackoverflow.com/a/6793274/14726116 -func (d *Dialect) AppendSequence(b []byte, table *schema.Table, field *schema.Field) []byte { - if field.IsPK && len(table.PKs) == 1 && field.CreateTableSQLType == sqltype.Integer { - b = append(b, " PRIMARY KEY AUTOINCREMENT"...) - } - return b -} - -// DefaultSchemaName is the "schema-name" of the main database. -// The details might differ from other dialects, but for all means and purposes -// "main" is the default schema in an SQLite database. -func (d *Dialect) DefaultSchema() string { - return "main" -} - -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/version.go b/vendor/github.com/uptrace/bun/dialect/sqlitedialect/version.go deleted file mode 100644 index e42267b8a..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.2.9" -} |