mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-03 20:47:35 +03:00
22 lines
444 B
Go
22 lines
444 B
Go
package persistence
|
|
|
|
import (
|
|
"github.com/navidrome/navidrome/db"
|
|
"github.com/pocketbase/dbx"
|
|
)
|
|
|
|
type dbxBuilder struct {
|
|
dbx.Builder
|
|
wdb dbx.Builder
|
|
}
|
|
|
|
func NewDBXBuilder(d db.DB) *dbxBuilder {
|
|
b := &dbxBuilder{}
|
|
b.Builder = dbx.NewFromDB(d.ReadDB(), db.Driver)
|
|
b.wdb = dbx.NewFromDB(d.WriteDB(), db.Driver)
|
|
return b
|
|
}
|
|
|
|
func (d *dbxBuilder) Transactional(f func(*dbx.Tx) error) (err error) {
|
|
return d.wdb.(*dbx.DB).Transactional(f)
|
|
}
|