updated deps; minor fixed; ent regen

This commit is contained in:
2022-08-12 23:00:34 +02:00
parent b7bbb97fd3
commit c7e193e88b
23 changed files with 414 additions and 807 deletions

View File

@@ -1,4 +1,4 @@
// Code generated by entc, DO NOT EDIT.
// Code generated by ent, DO NOT EDIT.
package enttest
@@ -10,6 +10,7 @@ import (
_ "git.harting.dev/ALHP/ALHP.GO/ent/runtime"
"entgo.io/ent/dialect/sql/schema"
"git.harting.dev/ALHP/ALHP.GO/ent/migrate"
)
type (
@@ -59,10 +60,7 @@ func Open(t TestingT, driverName, dataSourceName string, opts ...Option) *ent.Cl
t.Error(err)
t.FailNow()
}
if err := c.Schema.Create(context.Background(), o.migrateOpts...); err != nil {
t.Error(err)
t.FailNow()
}
migrateSchema(t, c, o)
return c
}
@@ -70,9 +68,17 @@ func Open(t TestingT, driverName, dataSourceName string, opts ...Option) *ent.Cl
func NewClient(t TestingT, opts ...Option) *ent.Client {
o := newOptions(opts)
c := ent.NewClient(o.opts...)
if err := c.Schema.Create(context.Background(), o.migrateOpts...); err != nil {
migrateSchema(t, c, o)
return c
}
func migrateSchema(t TestingT, c *ent.Client, o *options) {
tables, err := schema.CopyTables(migrate.Tables)
if err != nil {
t.Error(err)
t.FailNow()
}
if err := migrate.Create(context.Background(), c.Schema, tables, o.migrateOpts...); err != nil {
t.Error(err)
t.FailNow()
}
return c
}