codegen: move generated test helpers to new 'db_test.go' file
This commit is contained in:
19
pkg/codegen/tpl/db_test.go.tpl
Normal file
19
pkg/codegen/tpl/db_test.go.tpl
Normal file
@@ -0,0 +1,19 @@
|
||||
package db_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
. "git.offline-twitter.com/offline-labs/gas-stack/pkg/flowutils"
|
||||
|
||||
. "{{ .ModuleName }}/pkg/db"
|
||||
)
|
||||
|
||||
var TestDB *DB
|
||||
|
||||
func init() {
|
||||
TestDB = MakeDB("tmp")
|
||||
}
|
||||
func MakeDB(dbName string) *DB {
|
||||
db := Must(Create(fmt.Sprintf("file:%s?mode=memory&cache=shared", dbName)))
|
||||
return db
|
||||
}
|
||||
Reference in New Issue
Block a user