Skip to content

Commit

Permalink
enhance dbfixture.New to accept IDB interface
Browse files Browse the repository at this point in the history
  • Loading branch information
hirasawayuki committed Sep 18, 2023
1 parent 0c21152 commit 42d9515
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dbfixture/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ type fixtureRows struct {
}

type Encoder struct {
db *bun.DB
db bun.IDB
enc *yaml.Encoder
}

func NewEncoder(db *bun.DB, w io.Writer) *Encoder {
func NewEncoder(db bun.IDB, w io.Writer) *Encoder {
return &Encoder{
db: db,
enc: yaml.NewEncoder(w),
Expand Down
4 changes: 2 additions & 2 deletions dbfixture/fixture.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func WithBeforeInsert(fn BeforeInsertFunc) FixtureOption {
}

type Fixture struct {
db *bun.DB
db bun.IDB

recreateTables bool
truncateTables bool
Expand All @@ -81,7 +81,7 @@ type Fixture struct {
modelRows map[string]map[string]interface{}
}

func New(db *bun.DB, opts ...FixtureOption) *Fixture {
func New(db bun.IDB, opts ...FixtureOption) *Fixture {
f := &Fixture{
db: db,

Expand Down

0 comments on commit 42d9515

Please sign in to comment.