Skip to content

Commit

Permalink
Merge pull request #7 from withtally/feat/pkg-alias
Browse files Browse the repository at this point in the history
feat(pkg-alias): hard code for api ent to test
  • Loading branch information
jemilezzet authored Dec 5, 2023
2 parents be090e4 + bedaacc commit 7781579
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 16 deletions.
5 changes: 3 additions & 2 deletions codegen/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import (
)

type InputType struct {
Name string
Type interface{}
Name string
Alias *string
Type interface{}
}

type HandlersConfig struct {
Expand Down
21 changes: 19 additions & 2 deletions codegen/processor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/bindings/example.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions example/bindings/example.handlers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions example/ethgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,23 @@ import (

"github.com/withtally/synceth/codegen"
"github.com/withtally/synceth/example"
testexample "github.com/withtally/synceth/testexample/example"
)

func main() {
tea := "testexample"
if err := codegen.GenerateBindings("./artifacts", "./bindings", &codegen.BindingsConfig{
Fakes: true,
Handlers: codegen.HandlersConfig{
Generate: true,
InputTypes: []codegen.InputType{{Name: "tx", Type: &example.TestInput{}}},
Generate: true,
InputTypes: []codegen.InputType{
{
Name: "tx", Type: &example.TestInput{},
},
{
Name: "testtx", Type: &testexample.TestInput{}, Alias: &tea,
},
},
},
}); err != nil {
log.Fatalf("running ethgen codegen: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion example/example_test.go → example/test/example_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package example
package test

import (
"context"
Expand Down
3 changes: 3 additions & 0 deletions testexample/example/example.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package example

type TestInput struct{}

0 comments on commit 7781579

Please sign in to comment.