delve debug, vim swap files new file: anvildb.go ConnectAnvilDB func modified: main.go Moving things around, investigating interface references modified: models.go Removed previous AnvilDB, AnvilData struct workdata-work
parent
b886c39ac9
commit
5bbe08ded5
4 changed files with 40 additions and 38 deletions
@ -0,0 +1,2 @@ |
||||
__debug* |
||||
.*.sw* |
@ -0,0 +1,24 @@ |
||||
package main |
||||
|
||||
import ( |
||||
"database/sql" |
||||
|
||||
"github.com/uptrace/bun" |
||||
"github.com/uptrace/bun/dialect/pgdialect" |
||||
"github.com/uptrace/bun/driver/pgdriver" |
||||
"github.com/uptrace/bun/extra/bundebug" |
||||
) |
||||
|
||||
func ConnectAnvilDB(dsn string) *bun.DB { |
||||
sqldb := sql.OpenDB(pgdriver.NewConnector(pgdriver.WithDSN(dsn))) |
||||
db := bun.NewDB(sqldb, pgdialect.New()) |
||||
|
||||
db.AddQueryHook(bundebug.NewQueryHook( |
||||
bundebug.WithVerbose(true), |
||||
bundebug.FromEnv("BUNDEBUG"), |
||||
)) |
||||
return db |
||||
|
||||
} |
||||
|
||||
//func GetFeeds(db *bun.DB)
|
Loading…
Reference in new issue