Cleanup: rename uri
to dsn
"DSN" (Data Source Name) is used to indicate which database to open, and was intermixed with "URI". This is now consistent. No functional changes.
This commit is contained in:
parent
07576f3225
commit
d3e2638f84
@ -44,7 +44,7 @@ func OpenDB(ctx context.Context, dsn string) (*DB, error) {
|
|||||||
return db, nil
|
return db, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func openDB(ctx context.Context, uri string) (*DB, error) {
|
func openDB(ctx context.Context, dsn string) (*DB, error) {
|
||||||
globalLogLevel := log.Logger.GetLevel()
|
globalLogLevel := log.Logger.GetLevel()
|
||||||
dblogger := NewDBLogger(log.Level(globalLogLevel))
|
dblogger := NewDBLogger(log.Level(globalLogLevel))
|
||||||
|
|
||||||
@ -52,11 +52,11 @@ func openDB(ctx context.Context, uri string) (*DB, error) {
|
|||||||
Logger: dblogger,
|
Logger: dblogger,
|
||||||
}
|
}
|
||||||
|
|
||||||
return openDBWithConfig(uri, &config)
|
return openDBWithConfig(dsn, &config)
|
||||||
}
|
}
|
||||||
|
|
||||||
func openDBWithConfig(uri string, config *gorm.Config) (*DB, error) {
|
func openDBWithConfig(dsn string, config *gorm.Config) (*DB, error) {
|
||||||
dialector := sqlite.Open(uri)
|
dialector := sqlite.Open(dsn)
|
||||||
gormDB, err := gorm.Open(dialector, config)
|
gormDB, err := gorm.Open(dialector, config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user