-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Default Preparer for new code directory structure
- Loading branch information
dapeng
committed
Nov 6, 2024
1 parent
612e26b
commit 5fc2b15
Showing
15 changed files
with
167 additions
and
0 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,7 @@ | ||
# New code directory structure | ||
|
||
## 1. `import.gone.go` and `init.gone.go` will be generated by `gonectr` automatically | ||
|
||
## 2. `init.gone.go` is responsible for loading goner module to the `gone` framework | ||
|
||
## 3. `import.gone.go` is responsible for importing all packages which contain goner module in the project |
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,43 @@ | ||
module use_default | ||
|
||
go 1.22.2 | ||
|
||
require github.com/gone-io/gone v1.0.9 | ||
|
||
require ( | ||
github.com/bytedance/sonic v1.10.2 // indirect | ||
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect | ||
github.com/chenzhuoyu/iasm v0.9.1 // indirect | ||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect | ||
github.com/gin-contrib/sse v0.1.0 // indirect | ||
github.com/gin-gonic/gin v1.9.1 // indirect | ||
github.com/go-playground/locales v0.14.1 // indirect | ||
github.com/go-playground/universal-translator v0.18.1 // indirect | ||
github.com/go-playground/validator/v10 v10.17.0 // indirect | ||
github.com/goccy/go-json v0.10.2 // indirect | ||
github.com/golang/snappy v0.0.4 // indirect | ||
github.com/json-iterator/go v1.1.12 // indirect | ||
github.com/klauspost/cpuid/v2 v2.2.6 // indirect | ||
github.com/leodido/go-urn v1.3.0 // indirect | ||
github.com/mattn/go-isatty v0.0.20 // indirect | ||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||
github.com/modern-go/reflect2 v1.0.2 // indirect | ||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect | ||
github.com/soheilhy/cmux v0.1.5 // indirect | ||
github.com/syndtr/goleveldb v1.0.0 // indirect | ||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect | ||
github.com/ugorji/go/codec v1.2.12 // indirect | ||
golang.org/x/arch v0.7.0 // indirect | ||
golang.org/x/crypto v0.22.0 // indirect | ||
golang.org/x/net v0.24.0 // indirect | ||
golang.org/x/sys v0.21.0 // indirect | ||
golang.org/x/text v0.14.0 // indirect | ||
google.golang.org/protobuf v1.33.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978 // indirect | ||
xorm.io/xorm v1.3.2 // indirect | ||
) | ||
|
||
replace ( | ||
github.com/gone-io/gone v1.0.9 => ../../ | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,11 @@ | ||
package food | ||
|
||
import "github.com/gone-io/gone" | ||
|
||
type iFood struct { | ||
gone.Flag | ||
} | ||
|
||
func (s *iFood) Create() error { | ||
return nil | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,15 @@ | ||
package user | ||
|
||
import "github.com/gone-io/gone" | ||
|
||
type iSession struct { | ||
gone.Flag | ||
} | ||
|
||
func (s *iSession) Put(any) error { | ||
return nil | ||
} | ||
|
||
func (s *iSession) Get() (any, error) { | ||
return nil, nil | ||
} |
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,11 @@ | ||
package user | ||
|
||
import "github.com/gone-io/gone" | ||
|
||
type iUser struct { | ||
gone.Flag | ||
} | ||
|
||
func (s *iUser) Hello() string { | ||
return "hello" | ||
} |
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,19 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/gone-io/gone" | ||
"use_default/service" | ||
) | ||
|
||
func main() { | ||
gone.Default.Run(func(i struct { | ||
iFood service.IFood `gone:"*"` | ||
iSession service.ISession `gone:"*"` | ||
iUser service.IUser `gone:"*"` | ||
}) { | ||
_ = i.iSession.Put("ok") | ||
_ = i.iFood.Create() | ||
hello := i.iUser.Hello() | ||
println(hello) | ||
}) | ||
} |
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,5 @@ | ||
package service | ||
|
||
type IFood interface { | ||
Create() error | ||
} |
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,6 @@ | ||
package service | ||
|
||
type ISession interface { | ||
Put(any) error | ||
Get() (any, error) | ||
} |
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,5 @@ | ||
package service | ||
|
||
type IUser interface { | ||
Hello() string | ||
} |
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
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
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