Skip to content

Bunoffe is a small library to facilitate testing bun's queries.

License

Notifications You must be signed in to change notification settings

jlucasnsilva/bunoffe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

Bunoffe is a small library to facilitate testing bun's queries. One should feel free to copy and paste it directly into the code he/she is working on.

Usage

Exec

Instead of writing

db := bun.NewDB(sqldb, sqlitedialect.New())

result, err := bundb.NewExec().
    Model(&m).
    Exec(ctx)

Do

db := bun.NewDB(sqldb, sqlitedialect.New())
executor := bunoffe.QueryRealizer{}

err := executor.Exec(
    ctx,
    bundb.NewExec().
        Model(&m),
)

Exists

Instead of writing

db := bun.NewDB(sqldb, sqlitedialect.New())

exists, err := bundb.NewSelect().
    Model(&m).
    Exists(ctx)

Do

db := bun.NewDB(sqldb, sqlitedialect.New())
executor := bunoffe.QueryRealizer{}

exists, err := executor.Exists(
    ctx,
    bundb.NewSelect().
        Model(&m),
)

Scan

Instead of writing

db := bun.NewDB(sqldb, sqlitedialect.New())

err := bundb.NewSelect().
    Model(&m).
    Scan(ctx)

Do

db := bun.NewDB(sqldb, sqlitedialect.New())
executor := bunoffe.QueryRealizer{}

err := executor.Scan(
    ctx,
    bundb.NewSelect().
        Model(&m),
)

Testing

Bunoffe provides a set mocked operations. Check it out.

About

Bunoffe is a small library to facilitate testing bun's queries.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages