-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
151 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//go:build ignore | ||
// +build ignore | ||
|
||
package main | ||
|
||
import ( | ||
"log" | ||
|
||
"entgo.io/ent/entc" | ||
"entgo.io/ent/entc/gen" | ||
"github.com/openmeterio/openmeter/pkg/framework/entutils/entexpose" | ||
"github.com/openmeterio/openmeter/pkg/framework/entutils/entpaginate" | ||
) | ||
|
||
func main() { | ||
err := entc.Generate("./schema", | ||
&gen.Config{ | ||
Features: []gen.Feature{ | ||
gen.FeatureVersionedMigration, | ||
gen.FeatureLock, | ||
gen.FeatureUpsert, | ||
}, | ||
Target: "./db", | ||
Schema: "./schema", | ||
Package: "github.com/openmeterio/openmeter/openmeter/ent/db", | ||
}, | ||
entc.Extensions(entexpose.New(), entpaginate.New()), | ||
) | ||
if err != nil { | ||
log.Fatal("running ent codegen:", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package entdb | ||
|
||
//go:generate go run -mod=mod entgo.io/ent/cmd/ent generate --target ./db --feature sql/upsert --feature sql/lock --feature sql/versioned-migration --template ../../pkg/framework/entutils/expose.tpl --template ../../pkg/framework/entutils/paginate.tpl ./schema | ||
//go:generate go run -mod=readonly entc.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package entexpose | ||
|
||
import ( | ||
_ "embed" | ||
|
||
"entgo.io/ent/entc" | ||
"entgo.io/ent/entc/gen" | ||
) | ||
|
||
//go:embed expose.tpl | ||
var tmplfile string | ||
|
||
// Extension implements entc.Extension. | ||
type Extension struct { | ||
entc.DefaultExtension | ||
} | ||
|
||
func (Extension) Templates() []*gen.Template { | ||
return []*gen.Template{ | ||
gen.MustParse(gen.NewTemplate("entexpose").Parse(tmplfile)), | ||
} | ||
} | ||
|
||
func New() *Extension { | ||
return &Extension{} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package entpaginate | ||
|
||
import ( | ||
_ "embed" | ||
|
||
"entgo.io/ent/entc" | ||
"entgo.io/ent/entc/gen" | ||
) | ||
|
||
//go:embed paginate.tpl | ||
var tmplfile string | ||
|
||
// Extension implements entc.Extension. | ||
type Extension struct { | ||
entc.DefaultExtension | ||
} | ||
|
||
func (Extension) Templates() []*gen.Template { | ||
return []*gen.Template{ | ||
gen.MustParse(gen.NewTemplate("entpaginate").Parse(tmplfile)), | ||
} | ||
} | ||
|
||
func New() *Extension { | ||
return &Extension{} | ||
} |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
pkg/framework/entutils/paginate_test.go → ...ork/entutils/entpaginate/paginate_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package entutils_test | ||
package entpaginate_test | ||
|
||
import ( | ||
"context" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//go:build ignore | ||
// +build ignore | ||
|
||
package main | ||
|
||
import ( | ||
"log" | ||
|
||
"entgo.io/ent/entc" | ||
"entgo.io/ent/entc/gen" | ||
"github.com/openmeterio/openmeter/pkg/framework/entutils/entexpose" | ||
"github.com/openmeterio/openmeter/pkg/framework/entutils/entpaginate" | ||
) | ||
|
||
func main() { | ||
err := entc.Generate("./schema", | ||
&gen.Config{ | ||
Features: []gen.Feature{ | ||
gen.FeatureVersionedMigration, | ||
gen.FeatureLock, | ||
gen.FeatureUpsert, | ||
}, | ||
Target: "./db", | ||
Schema: "./schema", | ||
Package: "github.com/openmeterio/openmeter/pkg/framework/entutils/testutils/ent1/db", | ||
}, | ||
entc.Extensions(entexpose.New(), entpaginate.New()), | ||
) | ||
if err != nil { | ||
log.Fatal("running ent codegen:", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package ent1 | ||
|
||
//go:generate go run -mod=mod entgo.io/ent/cmd/ent generate --target ./db --feature sql/upsert --feature sql/lock --feature sql/versioned-migration ./schema --template ../../expose.tpl --template ../../paginate.tpl | ||
//go:generate go run -mod=mod entc.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//go:build ignore | ||
// +build ignore | ||
|
||
package main | ||
|
||
import ( | ||
"log" | ||
|
||
"entgo.io/ent/entc" | ||
"entgo.io/ent/entc/gen" | ||
"github.com/openmeterio/openmeter/pkg/framework/entutils/entexpose" | ||
) | ||
|
||
func main() { | ||
err := entc.Generate("./schema", | ||
&gen.Config{ | ||
Features: []gen.Feature{ | ||
gen.FeatureVersionedMigration, | ||
gen.FeatureLock, | ||
gen.FeatureUpsert, | ||
}, | ||
Target: "./db", | ||
Schema: "./schema", | ||
Package: "github.com/openmeterio/openmeter/pkg/framework/entutils/testutils/ent2/db", | ||
}, | ||
entc.Extensions(entexpose.New()), | ||
) | ||
if err != nil { | ||
log.Fatal("running ent codegen:", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package ent2 | ||
|
||
//go:generate go run -mod=mod entgo.io/ent/cmd/ent generate --target ./db --feature sql/upsert --feature sql/lock --feature sql/versioned-migration ./schema --template ../../expose.tpl | ||
//go:generate go run -mod=mod entc.go |