mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-31 21:52:24 -05:00
Pg to bun (#148)
* start moving to bun * changing more stuff * more * and yet more * tests passing * seems stable now * more big changes * small fix * little fixes
This commit is contained in:
parent
071eca20ce
commit
2dc9fc1626
713 changed files with 98694 additions and 22704 deletions
99
vendor/github.com/uptrace/bun/schema/dialect.go
generated
vendored
Normal file
99
vendor/github.com/uptrace/bun/schema/dialect.go
generated
vendored
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
package schema
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
"github.com/uptrace/bun/dialect"
|
||||
"github.com/uptrace/bun/dialect/feature"
|
||||
)
|
||||
|
||||
type Dialect interface {
|
||||
Init(db *sql.DB)
|
||||
|
||||
Name() dialect.Name
|
||||
Features() feature.Feature
|
||||
|
||||
Tables() *Tables
|
||||
OnTable(table *Table)
|
||||
|
||||
IdentQuote() byte
|
||||
Append(fmter Formatter, b []byte, v interface{}) []byte
|
||||
Appender(typ reflect.Type) AppenderFunc
|
||||
FieldAppender(field *Field) AppenderFunc
|
||||
Scanner(typ reflect.Type) ScannerFunc
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
type nopDialect struct {
|
||||
tables *Tables
|
||||
features feature.Feature
|
||||
|
||||
appenderMap sync.Map
|
||||
scannerMap sync.Map
|
||||
}
|
||||
|
||||
func newNopDialect() *nopDialect {
|
||||
d := new(nopDialect)
|
||||
d.tables = NewTables(d)
|
||||
d.features = feature.Returning
|
||||
return d
|
||||
}
|
||||
|
||||
func (d *nopDialect) Init(*sql.DB) {}
|
||||
|
||||
func (d *nopDialect) Name() dialect.Name {
|
||||
return dialect.Invalid
|
||||
}
|
||||
|
||||
func (d *nopDialect) Features() feature.Feature {
|
||||
return d.features
|
||||
}
|
||||
|
||||
func (d *nopDialect) Tables() *Tables {
|
||||
return d.tables
|
||||
}
|
||||
|
||||
func (d *nopDialect) OnField(field *Field) {}
|
||||
|
||||
func (d *nopDialect) OnTable(table *Table) {}
|
||||
|
||||
func (d *nopDialect) IdentQuote() byte {
|
||||
return '"'
|
||||
}
|
||||
|
||||
func (d *nopDialect) Append(fmter Formatter, b []byte, v interface{}) []byte {
|
||||
return Append(fmter, b, v, nil)
|
||||
}
|
||||
|
||||
func (d *nopDialect) Appender(typ reflect.Type) AppenderFunc {
|
||||
if v, ok := d.appenderMap.Load(typ); ok {
|
||||
return v.(AppenderFunc)
|
||||
}
|
||||
|
||||
fn := Appender(typ, nil)
|
||||
|
||||
if v, ok := d.appenderMap.LoadOrStore(typ, fn); ok {
|
||||
return v.(AppenderFunc)
|
||||
}
|
||||
return fn
|
||||
}
|
||||
|
||||
func (d *nopDialect) FieldAppender(field *Field) AppenderFunc {
|
||||
return FieldAppender(d, field)
|
||||
}
|
||||
|
||||
func (d *nopDialect) Scanner(typ reflect.Type) ScannerFunc {
|
||||
if v, ok := d.scannerMap.Load(typ); ok {
|
||||
return v.(ScannerFunc)
|
||||
}
|
||||
|
||||
fn := Scanner(typ)
|
||||
|
||||
if v, ok := d.scannerMap.LoadOrStore(typ, fn); ok {
|
||||
return v.(ScannerFunc)
|
||||
}
|
||||
return fn
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue