2022-08-30 02:30:36 +00:00
|
|
|
package mocks
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-09-24 19:33:38 +00:00
|
|
|
"github.com/hay-kot/homebox/backend/ent"
|
|
|
|
"github.com/hay-kot/homebox/backend/internal/repo"
|
2022-08-30 02:30:36 +00:00
|
|
|
_ "github.com/mattn/go-sqlite3"
|
|
|
|
)
|
|
|
|
|
|
|
|
func GetEntRepos() (*repo.AllRepos, func() error) {
|
|
|
|
c, err := ent.Open("sqlite3", "file:ent?mode=memory&cache=shared&_fk=1")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := c.Schema.Create(context.Background()); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return repo.EntAllRepos(c), c.Close
|
|
|
|
}
|