diff --git a/gomall/Makefile b/gomall/Makefile index d1f7badb..18405e80 100644 --- a/gomall/Makefile +++ b/gomall/Makefile @@ -24,7 +24,7 @@ gen-client: ## gen client code of {svc}. example: make gen svc=product .PHONY: gen-server gen-server: ## gen service code of {svc}. example: make gen-server svc=product - @cd app/${svc} && cwgo server --type RPC --service ${svc} --module github.com/cloudwego/biz-demo/gomall/app/${svc} --pass "-use github.com/cloudwego/biz-demo/gomall/rpc_gen" -I ../../idl --idl ../../idl/${svc}.proto + @cd app/${svc} && cwgo server --type RPC --service ${svc} --module github.com/cloudwego/biz-demo/gomall/app/${svc} --pass "-use github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen" -I ../../idl --idl ../../idl/${svc}.proto .PHONY: gen-checkout-client gen-checkout-client: diff --git a/gomall/app/checkout/biz/service/checkout.go b/gomall/app/checkout/biz/service/checkout.go index c226b565..1ff6fc9a 100644 --- a/gomall/app/checkout/biz/service/checkout.go +++ b/gomall/app/checkout/biz/service/checkout.go @@ -20,6 +20,11 @@ import ( "fmt" "strconv" + "github.com/cloudwego/biz-demo/gomall/app/checkout/infra/mq" + "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/email" + "github.com/nats-io/nats.go" + "google.golang.org/protobuf/proto" + "github.com/cloudwego/biz-demo/gomall/app/checkout/infra/rpc" "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/cart" checkout "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/checkout" @@ -135,6 +140,15 @@ func (s *CheckoutService) Run(req *checkout.CheckoutReq) (resp *checkout.Checkou err = fmt.Errorf("Charge.err:%v", err) return } + data, _ := proto.Marshal(&email.EmailReq{ + From: "from@example.com", + To: "to@example.com", + ContentType: "text/plain", + Subject: "You just created an order in CloudWeGo shop", + Content: "You just created an order in CloudWeGo shop", + }) + msg := &nats.Msg{Subject: "email", Data: data} + _ = mq.Nc.PublishMsg(msg) klog.Info(paymentResult) // change order state diff --git a/gomall/app/checkout/go.mod b/gomall/app/checkout/go.mod index 9eb94394..baafd793 100644 --- a/gomall/app/checkout/go.mod +++ b/gomall/app/checkout/go.mod @@ -9,7 +9,6 @@ replace github.com/cloudwego/biz-demo/gomall/rpc_gen => ../../rpc_gen require ( github.com/cloudwego/biz-demo/gomall/common v0.0.0-00010101000000-000000000000 github.com/cloudwego/biz-demo/gomall/rpc_gen v0.0.0-00010101000000-000000000000 - github.com/cloudwego/fastpb v0.0.4 github.com/cloudwego/kitex v0.8.0 github.com/joho/godotenv v1.5.1 github.com/kitex-contrib/config-etcd v0.1.0 @@ -18,6 +17,7 @@ require ( github.com/kitex-contrib/obs-opentelemetry/logging/zap v0.0.0-20231211030816-1f9e0f7bcee3 github.com/kitex-contrib/registry-consul v0.0.0-20230406075225-7d341f036654 github.com/kr/pretty v0.3.1 + github.com/nats-io/nats.go v1.31.0 github.com/prometheus/client_golang v1.18.0 github.com/redis/go-redis/v9 v9.3.1 go.opentelemetry.io/otel v1.21.0 @@ -44,6 +44,7 @@ require ( github.com/choleraehyq/pid v0.0.17 // indirect github.com/cloudwego/configmanager v0.2.0 // indirect github.com/cloudwego/dynamicgo v0.1.6 // indirect + github.com/cloudwego/fastpb v0.0.4 // indirect github.com/cloudwego/frugal v0.1.12 // indirect github.com/cloudwego/localsession v0.0.2 // indirect github.com/cloudwego/netpoll v0.5.1 // indirect @@ -75,6 +76,7 @@ require ( github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.0 // indirect github.com/klauspost/cpuid/v2 v2.2.6 // indirect github.com/kr/text v0.2.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -85,6 +87,8 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/gls v0.0.0-20220109145502-612d0167dce5 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/nats-io/nkeys v0.4.5 // indirect + github.com/nats-io/nuid v1.0.1 // indirect github.com/oleiade/lane v1.0.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.5.0 // indirect @@ -111,6 +115,7 @@ require ( go.opentelemetry.io/proto/otlp v1.0.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/arch v0.6.0 // indirect + golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect diff --git a/gomall/app/checkout/go.sum b/gomall/app/checkout/go.sum index 91b492ed..20cabfe1 100644 --- a/gomall/app/checkout/go.sum +++ b/gomall/app/checkout/go.sum @@ -366,6 +366,8 @@ github.com/kitex-contrib/obs-opentelemetry/logging/zap v0.0.0-20231211030816-1f9 github.com/kitex-contrib/obs-opentelemetry/logging/zap v0.0.0-20231211030816-1f9e0f7bcee3/go.mod h1:t9iabI0fK17O94vjXb6RfI69YOpenwxHLsR9ppWBBWs= github.com/kitex-contrib/registry-consul v0.0.0-20230406075225-7d341f036654 h1:mHprV3SyDeJtOJEUsVX3I0wrAsnK7Q+vBmJ+eZuQSJU= github.com/kitex-contrib/registry-consul v0.0.0-20230406075225-7d341f036654/go.mod h1:NR9ytGiooeJGatm/4/PpkW6mcAQI4h9Cf/ToOILHWuY= +github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= +github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.1.0/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= @@ -427,6 +429,12 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nats-io/nats.go v1.31.0 h1:/WFBHEc/dOKBF6qf1TZhrdEfTmOZ5JzdJ+Y3m6Y/p7E= +github.com/nats-io/nats.go v1.31.0/go.mod h1:di3Bm5MLsoB4Bx61CBTsxuarI36WbhAwOm8QrW39+i8= +github.com/nats-io/nkeys v0.4.5 h1:Zdz2BUlFm4fJlierwvGK+yl20IAKUm7eV6AAZXEhkPk= +github.com/nats-io/nkeys v0.4.5/go.mod h1:XUkxdLPTufzlihbamfzQ7mw/VGx6ObUs+0bN5sNvt64= +github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= github.com/oleiade/lane v1.0.1 h1:hXofkn7GEOubzTwNpeL9MaNy8WxolCYb9cInAIeqShU= github.com/oleiade/lane v1.0.1/go.mod h1:IyTkraa4maLfjq/GmHR+Dxb4kCMtEGeb+qmhlrQ5Mk4= @@ -598,6 +606,8 @@ golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= diff --git a/gomall/app/checkout/infra/mq/nats.go b/gomall/app/checkout/infra/mq/nats.go new file mode 100644 index 00000000..e926a9b8 --- /dev/null +++ b/gomall/app/checkout/infra/mq/nats.go @@ -0,0 +1,17 @@ +package mq + +import ( + "github.com/nats-io/nats.go" +) + +var ( + Nc *nats.Conn + err error +) + +func Init() { + Nc, err = nats.Connect(nats.DefaultURL) + if err != nil { + panic(err) + } +} diff --git a/gomall/app/checkout/main.go b/gomall/app/checkout/main.go index 01d26126..22cc674c 100644 --- a/gomall/app/checkout/main.go +++ b/gomall/app/checkout/main.go @@ -19,6 +19,7 @@ import ( "os" "github.com/cloudwego/biz-demo/gomall/app/checkout/conf" + "github.com/cloudwego/biz-demo/gomall/app/checkout/infra/mq" "github.com/cloudwego/biz-demo/gomall/app/checkout/infra/mtl" "github.com/cloudwego/biz-demo/gomall/app/checkout/infra/rpc" "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/checkout/checkoutservice" @@ -39,6 +40,7 @@ func main() { _ = godotenv.Load() mtl.InitMtl() rpc.InitClient() + mq.Init() opts := kitexInit() svr := checkoutservice.NewServer(new(CheckoutServiceImpl), opts...) diff --git a/gomall/app/email/.gitignore b/gomall/app/email/.gitignore new file mode 100644 index 00000000..68810865 --- /dev/null +++ b/gomall/app/email/.gitignore @@ -0,0 +1,35 @@ +*.o +*.a +*.so +_obj +_test +*.[568vq] +[568vq].out +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* +_testmain.go +*.exe +*.exe~ +*.test +*.prof +*.rar +*.zip +*.gz +*.psd +*.bmd +*.cfg +*.pptx +*.log +*nohup.out +*settings.pyc +*.sublime-project +*.sublime-workspace +!.gitkeep +.DS_Store +/.idea +/.vscode +/output +*.local.yml diff --git a/gomall/app/email/biz/consumer/consumer.go b/gomall/app/email/biz/consumer/consumer.go new file mode 100644 index 00000000..650fac30 --- /dev/null +++ b/gomall/app/email/biz/consumer/consumer.go @@ -0,0 +1,7 @@ +package consumer + +import "github.com/cloudwego/biz-demo/gomall/app/email/biz/consumer/email" + +func Init() { + email.ConsumerInit() +} diff --git a/gomall/app/email/biz/consumer/email/email.go b/gomall/app/email/biz/consumer/email/email.go new file mode 100644 index 00000000..fd0d80f4 --- /dev/null +++ b/gomall/app/email/biz/consumer/email/email.go @@ -0,0 +1,32 @@ +package email + +import ( + "github.com/cloudwego/biz-demo/gomall/app/email/infra/mq" + "github.com/cloudwego/kitex/pkg/klog" + "github.com/cloudwego/kitex/server" + "github.com/nats-io/nats.go" + "google.golang.org/protobuf/proto" + + "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/email" +) + +func ConsumerInit() { + // Connect to a server + + sub, err := mq.Nc.Subscribe("email", func(m *nats.Msg) { + var req email.EmailReq + err := proto.Unmarshal(m.Data, &req) + if err != nil { + klog.Error(err) + } + klog.Infof("Received a message: %#v", &req) + }) + if err != nil { + panic(err) + } + + server.RegisterShutdownHook(func() { + sub.Unsubscribe() //nolint:errcheck + mq.Nc.Close() + }) +} diff --git a/gomall/app/email/biz/consumer/email/email_test.go b/gomall/app/email/biz/consumer/email/email_test.go new file mode 100644 index 00000000..c6fac112 --- /dev/null +++ b/gomall/app/email/biz/consumer/email/email_test.go @@ -0,0 +1,32 @@ +package email + +import ( + "testing" + + "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/email" + + "github.com/nats-io/nats.go" + "google.golang.org/protobuf/proto" +) + +func TestEmailConsumer(t *testing.T) { + // Connect to a server + nc, _ := nats.Connect(nats.DefaultURL) + defer nc.Close() + + data, err := proto.Marshal(&email.EmailReq{ + From: "hello@example.com", + To: "to@example.com", + ContentType: "text/plain", + Subject: "hello world", + Content: "hello world", + }) + if err != nil { + t.Error(err) + } + + err = nc.PublishMsg(&nats.Msg{Subject: "email", Data: data}) + if err != nil { + panic(err) + } +} diff --git a/gomall/app/email/biz/dal/init.go b/gomall/app/email/biz/dal/init.go new file mode 100644 index 00000000..d118086d --- /dev/null +++ b/gomall/app/email/biz/dal/init.go @@ -0,0 +1,11 @@ +package dal + +import ( + "github.com/cloudwego/biz-demo/gomall/app/email/biz/dal/mysql" + "github.com/cloudwego/biz-demo/gomall/app/email/biz/dal/redis" +) + +func Init() { + redis.Init() + mysql.Init() +} diff --git a/gomall/app/email/biz/dal/mysql/init.go b/gomall/app/email/biz/dal/mysql/init.go new file mode 100644 index 00000000..24e2e538 --- /dev/null +++ b/gomall/app/email/biz/dal/mysql/init.go @@ -0,0 +1,25 @@ +package mysql + +import ( + "github.com/cloudwego/biz-demo/gomall/app/email/conf" + + "gorm.io/driver/mysql" + "gorm.io/gorm" +) + +var ( + DB *gorm.DB + err error +) + +func Init() { + DB, err = gorm.Open(mysql.Open(conf.GetConf().MySQL.DSN), + &gorm.Config{ + PrepareStmt: true, + SkipDefaultTransaction: true, + }, + ) + if err != nil { + panic(err) + } +} diff --git a/gomall/app/email/biz/dal/redis/init.go b/gomall/app/email/biz/dal/redis/init.go new file mode 100644 index 00000000..1924c523 --- /dev/null +++ b/gomall/app/email/biz/dal/redis/init.go @@ -0,0 +1,22 @@ +package redis + +import ( + "context" + + "github.com/cloudwego/biz-demo/gomall/app/email/conf" + "github.com/redis/go-redis/v9" +) + +var RedisClient *redis.Client + +func Init() { + RedisClient = redis.NewClient(&redis.Options{ + Addr: conf.GetConf().Redis.Address, + Username: conf.GetConf().Redis.Username, + Password: conf.GetConf().Redis.Password, + DB: conf.GetConf().Redis.DB, + }) + if err := RedisClient.Ping(context.Background()).Err(); err != nil { + panic(err) + } +} diff --git a/gomall/app/email/biz/service/send.go b/gomall/app/email/biz/service/send.go new file mode 100644 index 00000000..040936e6 --- /dev/null +++ b/gomall/app/email/biz/service/send.go @@ -0,0 +1,21 @@ +package service + +import ( + "context" + + email "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/email" +) + +type SendService struct { + ctx context.Context +} // NewSendService new SendService +func NewSendService(ctx context.Context) *SendService { + return &SendService{ctx: ctx} +} + +// Run create note info +func (s *SendService) Run(req *email.EmailReq) (resp *email.EmailResp, err error) { + // Finish your business logic. + + return +} diff --git a/gomall/app/email/biz/service/send_test.go b/gomall/app/email/biz/service/send_test.go new file mode 100644 index 00000000..365cfa34 --- /dev/null +++ b/gomall/app/email/biz/service/send_test.go @@ -0,0 +1,21 @@ +package service + +import ( + "context" + "testing" + + email "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/email" +) + +func TestSend_Run(t *testing.T) { + ctx := context.Background() + s := NewSendService(ctx) + // init req and assert value + + req := &email.EmailReq{} + resp, err := s.Run(req) + t.Logf("err: %v", err) + t.Logf("resp: %v", resp) + + // todo: edit your unit test +} diff --git a/gomall/app/email/build.sh b/gomall/app/email/build.sh new file mode 100644 index 00000000..69740a39 --- /dev/null +++ b/gomall/app/email/build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +RUN_NAME="email" +mkdir -p output/bin output/conf +cp script/* output/ +cp -r conf/* output/conf +chmod +x output/bootstrap.sh +go build -o output/bin/${RUN_NAME} diff --git a/gomall/app/email/conf/conf.go b/gomall/app/email/conf/conf.go new file mode 100644 index 00000000..a2184bd2 --- /dev/null +++ b/gomall/app/email/conf/conf.go @@ -0,0 +1,112 @@ +package conf + +import ( + "os" + "path/filepath" + "sync" + + "github.com/cloudwego/kitex/pkg/klog" + "github.com/kr/pretty" + "gopkg.in/validator.v2" + "gopkg.in/yaml.v2" +) + +var ( + conf *Config + once sync.Once +) + +type Config struct { + Env string + Kitex Kitex `yaml:"kitex"` + MySQL MySQL `yaml:"mysql"` + Redis Redis `yaml:"redis"` + Registry Registry `yaml:"registry"` +} + +type MySQL struct { + DSN string `yaml:"dsn"` +} + +type Redis struct { + Address string `yaml:"address"` + Username string `yaml:"username"` + Password string `yaml:"password"` + DB int `yaml:"db"` +} + +type Kitex struct { + Service string `yaml:"service"` + Address string `yaml:"address"` + EnablePprof bool `yaml:"enable_pprof"` + EnableGzip bool `yaml:"enable_gzip"` + EnableAccessLog bool `yaml:"enable_access_log"` + LogLevel string `yaml:"log_level"` + LogFileName string `yaml:"log_file_name"` + LogMaxSize int `yaml:"log_max_size"` + LogMaxBackups int `yaml:"log_max_backups"` + LogMaxAge int `yaml:"log_max_age"` +} + +type Registry struct { + RegistryAddress []string `yaml:"registry_address"` + Username string `yaml:"username"` + Password string `yaml:"password"` +} + +// GetConf gets configuration instance +func GetConf() *Config { + once.Do(initConf) + return conf +} + +func initConf() { + prefix := "conf" + confFileRelPath := filepath.Join(prefix, filepath.Join(GetEnv(), "conf.yaml")) + content, err := os.ReadFile(confFileRelPath) + if err != nil { + panic(err) + } + conf = new(Config) + err = yaml.Unmarshal(content, conf) + if err != nil { + klog.Error("parse yaml error - %v", err) + panic(err) + } + if err := validator.Validate(conf); err != nil { + klog.Error("validate config error - %v", err) + panic(err) + } + conf.Env = GetEnv() + pretty.Printf("%+v\n", conf) +} + +func GetEnv() string { + e := os.Getenv("GO_ENV") + if len(e) == 0 { + return "test" + } + return e +} + +func LogLevel() klog.Level { + level := GetConf().Kitex.LogLevel + switch level { + case "trace": + return klog.LevelTrace + case "debug": + return klog.LevelDebug + case "info": + return klog.LevelInfo + case "notice": + return klog.LevelNotice + case "warn": + return klog.LevelWarn + case "error": + return klog.LevelError + case "fatal": + return klog.LevelFatal + default: + return klog.LevelInfo + } +} diff --git a/gomall/app/email/conf/dev/conf.yaml b/gomall/app/email/conf/dev/conf.yaml new file mode 100644 index 00000000..00cc12a9 --- /dev/null +++ b/gomall/app/email/conf/dev/conf.yaml @@ -0,0 +1,23 @@ +kitex: + service: "email" + address: ":8888" + log_level: info + log_file_name: "log/kitex.log" + log_max_size: 10 + log_max_age: 3 + log_max_backups: 50 + +registry: + registry_address: + - 127.0.0.1:2379 + username: "" + password: "" + +mysql: + dsn: "gorm:gorm@tcp(127.0.0.1:3306)/gorm?charset=utf8mb4&parseTime=True&loc=Local" + +redis: + address: "127.0.0.1:6379" + username: "" + password: "" + db: 0 diff --git a/gomall/app/email/conf/online/conf.yaml b/gomall/app/email/conf/online/conf.yaml new file mode 100644 index 00000000..00cc12a9 --- /dev/null +++ b/gomall/app/email/conf/online/conf.yaml @@ -0,0 +1,23 @@ +kitex: + service: "email" + address: ":8888" + log_level: info + log_file_name: "log/kitex.log" + log_max_size: 10 + log_max_age: 3 + log_max_backups: 50 + +registry: + registry_address: + - 127.0.0.1:2379 + username: "" + password: "" + +mysql: + dsn: "gorm:gorm@tcp(127.0.0.1:3306)/gorm?charset=utf8mb4&parseTime=True&loc=Local" + +redis: + address: "127.0.0.1:6379" + username: "" + password: "" + db: 0 diff --git a/gomall/app/email/conf/test/conf.yaml b/gomall/app/email/conf/test/conf.yaml new file mode 100644 index 00000000..00cc12a9 --- /dev/null +++ b/gomall/app/email/conf/test/conf.yaml @@ -0,0 +1,23 @@ +kitex: + service: "email" + address: ":8888" + log_level: info + log_file_name: "log/kitex.log" + log_max_size: 10 + log_max_age: 3 + log_max_backups: 50 + +registry: + registry_address: + - 127.0.0.1:2379 + username: "" + password: "" + +mysql: + dsn: "gorm:gorm@tcp(127.0.0.1:3306)/gorm?charset=utf8mb4&parseTime=True&loc=Local" + +redis: + address: "127.0.0.1:6379" + username: "" + password: "" + db: 0 diff --git a/gomall/app/email/docker-compose.yaml b/gomall/app/email/docker-compose.yaml new file mode 100644 index 00000000..45be3406 --- /dev/null +++ b/gomall/app/email/docker-compose.yaml @@ -0,0 +1,15 @@ +version: '3' +services: + mysql: + image: 'mysql:latest' + ports: + - 3306:3306 + environment: + - MYSQL_DATABASE=gorm + - MYSQL_USER=gorm + - MYSQL_PASSWORD=gorm + - MYSQL_RANDOM_ROOT_PASSWORD="yes" + redis: + image: 'redis:latest' + ports: + - 6379:6379 diff --git a/gomall/app/email/go.mod b/gomall/app/email/go.mod new file mode 100644 index 00000000..d5046b1e --- /dev/null +++ b/gomall/app/email/go.mod @@ -0,0 +1,82 @@ +module github.com/cloudwego/biz-demo/gomall/app/email + +go 1.21.5 + +replace github.com/apache/thrift => github.com/apache/thrift v0.13.0 + +replace github.com/cloudwego/biz-demo/gomall/rpc_gen => ../../rpc_gen + +require ( + github.com/cloudwego/biz-demo/gomall/rpc_gen v0.0.0-00010101000000-000000000000 + github.com/cloudwego/kitex v0.8.0 + github.com/kitex-contrib/obs-opentelemetry/logging/logrus v0.0.0-20231211030816-1f9e0f7bcee3 + github.com/kr/pretty v0.3.1 + github.com/nats-io/nats.go v1.31.0 + github.com/redis/go-redis/v9 v9.3.1 + go.uber.org/zap v1.26.0 + google.golang.org/protobuf v1.32.0 + gopkg.in/natefinch/lumberjack.v2 v2.2.1 + gopkg.in/validator.v2 v2.0.1 + gopkg.in/yaml.v2 v2.4.0 + gorm.io/driver/mysql v1.5.2 + gorm.io/gorm v1.25.5 +) + +require ( + github.com/apache/thrift v0.19.0 // indirect + github.com/bytedance/gopkg v0.0.0-20231219111115-a5eedbe96960 // indirect + github.com/bytedance/sonic v1.10.2 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect + github.com/chenzhuoyu/iasm v0.9.1 // indirect + github.com/choleraehyq/pid v0.0.17 // indirect + github.com/cloudwego/configmanager v0.2.0 // indirect + github.com/cloudwego/dynamicgo v0.1.6 // indirect + github.com/cloudwego/fastpb v0.0.4 // indirect + github.com/cloudwego/frugal v0.1.12 // indirect + github.com/cloudwego/localsession v0.0.2 // indirect + github.com/cloudwego/netpoll v0.5.1 // indirect + github.com/cloudwego/thriftgo v0.3.3 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/fatih/structtag v1.2.0 // indirect + github.com/go-sql-driver/mysql v1.7.1 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/pprof v0.0.0-20231212022811-ec68065c825e // indirect + github.com/iancoleman/strcase v0.2.0 // indirect + github.com/jhump/protoreflect v1.8.2 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.4 // indirect + github.com/klauspost/cpuid/v2 v2.2.6 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/gls v0.0.0-20220109145502-612d0167dce5 // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/nats-io/nkeys v0.4.7 // indirect + github.com/nats-io/nuid v1.0.1 // indirect + github.com/oleiade/lane v1.0.1 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect + github.com/stretchr/testify v1.8.4 // indirect + github.com/tidwall/gjson v1.17.0 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.1 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + go.opentelemetry.io/otel v1.21.0 // indirect + go.opentelemetry.io/otel/sdk v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect + go.uber.org/goleak v1.3.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/arch v0.6.0 // indirect + golang.org/x/crypto v0.17.0 // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/gomall/app/email/go.sum b/gomall/app/email/go.sum new file mode 100644 index 00000000..0620ccc2 --- /dev/null +++ b/gomall/app/email/go.sum @@ -0,0 +1,491 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= +git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY= +github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= +github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= +github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM= +github.com/apache/thrift v0.13.0 h1:5hryIiq9gtn+MiLVn0wP37kb/uTeRZgN08WoCsAhIhI= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= +github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= +github.com/brianvoe/gofakeit/v6 v6.16.0/go.mod h1:Ow6qC71xtwm79anlwKRlWZW6zVq9D2XHE4QSSMP/rU8= +github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= +github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= +github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= +github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= +github.com/bytedance/gopkg v0.0.0-20220413063733-65bf48ffb3a7/go.mod h1:2ZlV9BaUH4+NXIBF0aMdKKAnHTzqH+iMU4KUjAbL23Q= +github.com/bytedance/gopkg v0.0.0-20220509134931-d1878f638986/go.mod h1:2ZlV9BaUH4+NXIBF0aMdKKAnHTzqH+iMU4KUjAbL23Q= +github.com/bytedance/gopkg v0.0.0-20220531084716-665b4f21126f/go.mod h1:2ZlV9BaUH4+NXIBF0aMdKKAnHTzqH+iMU4KUjAbL23Q= +github.com/bytedance/gopkg v0.0.0-20230531144706-a12972768317/go.mod h1:FtQG3YbQG9L/91pbKSw787yBQPutC+457AvDW77fgUQ= +github.com/bytedance/gopkg v0.0.0-20230728082804-614d0af6619b/go.mod h1:FtQG3YbQG9L/91pbKSw787yBQPutC+457AvDW77fgUQ= +github.com/bytedance/gopkg v0.0.0-20231219111115-a5eedbe96960 h1:t2xAuIlnhWJDIpcHZEbpoVsQH1hOk9eGGaKU2dXl1PE= +github.com/bytedance/gopkg v0.0.0-20231219111115-a5eedbe96960/go.mod h1:FtQG3YbQG9L/91pbKSw787yBQPutC+457AvDW77fgUQ= +github.com/bytedance/mockey v1.2.0/go.mod h1:+Jm/fzWZAuhEDrPXVjDf/jLM2BlLXJkwk94zf2JZ3X4= +github.com/bytedance/mockey v1.2.7 h1:8j4yCqS5OmMe2dQCxPit4FVkwTK9nrykIgbOZN3s28o= +github.com/bytedance/mockey v1.2.7/go.mod h1:bNrUnI1u7+pAc0TYDgPATM+wF2yzHxmNH+iDXg4AOCU= +github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= +github.com/bytedance/sonic v1.8.8/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= +github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM= +github.com/bytedance/sonic v1.10.2 h1:GQebETVBxYB7JGWJtLBi07OVzWwt+8dWA00gEVW2ZFE= +github.com/bytedance/sonic v1.10.2/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= +github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= +github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0= +github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpVsBuRksnlj1mLy4AWzRNQYxauNi62uWcE3to6eA= +github.com/chenzhuoyu/iasm v0.0.0-20220818063314-28c361dae733/go.mod h1:wOQ0nsbeOLa2awv8bUYFW/EHXbjQMlZ10fAlXDB2sz8= +github.com/chenzhuoyu/iasm v0.0.0-20230222070914-0b1b64b0e762/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog= +github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog= +github.com/chenzhuoyu/iasm v0.9.1 h1:tUHQJXo3NhBqw6s33wkGn9SP3bvrWLdlVIJ3hQBL7P0= +github.com/chenzhuoyu/iasm v0.9.1/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog= +github.com/choleraehyq/pid v0.0.13/go.mod h1:uhzeFgxJZWQsZulelVQZwdASxQ9TIPZYL4TPkQMtL/U= +github.com/choleraehyq/pid v0.0.15/go.mod h1:uhzeFgxJZWQsZulelVQZwdASxQ9TIPZYL4TPkQMtL/U= +github.com/choleraehyq/pid v0.0.16/go.mod h1:uhzeFgxJZWQsZulelVQZwdASxQ9TIPZYL4TPkQMtL/U= +github.com/choleraehyq/pid v0.0.17 h1:BLBfHTllp2nRRbZ/cOFHKlx9oWJuMwKmp7GqB5d58Hk= +github.com/choleraehyq/pid v0.0.17/go.mod h1:uhzeFgxJZWQsZulelVQZwdASxQ9TIPZYL4TPkQMtL/U= +github.com/chzyer/logex v1.2.0/go.mod h1:9+9sk7u7pGNWYMkh0hdiL++6OeibzJccyQU4p4MedaY= +github.com/chzyer/readline v1.5.0/go.mod h1:x22KAscuvRqlLoK9CsoYsmxoXZMMFVyOl86cAH8qUic= +github.com/chzyer/test v0.0.0-20210722231415-061457976a23/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudwego/configmanager v0.2.0 h1:niVpVg+wQ+npNqnH3dup96SMbR02Pk+tNErubYCJqKo= +github.com/cloudwego/configmanager v0.2.0/go.mod h1:FLIQTjxsZRGjnmDhTttWQTy6f6DghPTatfBVOs2gQLk= +github.com/cloudwego/dynamicgo v0.1.0/go.mod h1:Mdsz0XGsIImi15vxhZaHZpspNChEmBMIiWkUfD6JDKg= +github.com/cloudwego/dynamicgo v0.1.6 h1:ogGaEi5DTFlAgM940RLuOeP5QcNiQxj9GJ/7WeU1i4w= +github.com/cloudwego/dynamicgo v0.1.6/go.mod h1:WzbIYLbhR4tjUhEMmRZRNIQXZu5J18oPurGDj5UmU9I= +github.com/cloudwego/fastpb v0.0.3/go.mod h1:/V13XFTq2TUkxj2qWReV8MwfPC4NnPcy6FsrojnsSG0= +github.com/cloudwego/fastpb v0.0.4 h1:/ROVVfoFtpfc+1pkQLzGs+azjxUbSOsAqSY4tAAx4mg= +github.com/cloudwego/fastpb v0.0.4/go.mod h1:/V13XFTq2TUkxj2qWReV8MwfPC4NnPcy6FsrojnsSG0= +github.com/cloudwego/frugal v0.1.3/go.mod h1:b981ViPYdhI56aFYsoMjl9kv6yeqYSO+iEz2jrhkCgI= +github.com/cloudwego/frugal v0.1.6/go.mod h1:9ElktKsh5qd2zDBQ5ENhPSQV7F2dZ/mXlr1eaZGDBFs= +github.com/cloudwego/frugal v0.1.12 h1:/AFrjnMVOBBd6d5Vn59bU2IhlOP2vs/jQCsJ2seJBfs= +github.com/cloudwego/frugal v0.1.12/go.mod h1:zFBA63ne4+Tz4qayRZFZf+ZVwGqTzb+1Xe3ZDCq+Wfc= +github.com/cloudwego/kitex v0.3.2/go.mod h1:/XD07VpUD9VQWmmoepASgZ6iw//vgWikVA9MpzLC5i0= +github.com/cloudwego/kitex v0.4.4/go.mod h1:3FcH5h9Qw+dhRljSzuGSpWuThttA8DvK0BsL7HUYydo= +github.com/cloudwego/kitex v0.6.1/go.mod h1:zI1GBrjT0qloTikcCfQTgxg3Ws+yQMyaChEEOcGNUvA= +github.com/cloudwego/kitex v0.8.0 h1:eL6Xb2vnHfOjvDqmPsvCuheDo513lOc1HG6hSHGiFyM= +github.com/cloudwego/kitex v0.8.0/go.mod h1:5o98nYKp8GwauvA1hhJwTA3YQcPa8Nu5tx+2j+JjwoM= +github.com/cloudwego/localsession v0.0.2 h1:N9/IDtCPj1fCL9bCTP+DbXx3f40YjVYWcwkJG0YhQkY= +github.com/cloudwego/localsession v0.0.2/go.mod h1:kiJxmvAcy4PLgKtEnPS5AXed3xCiXcs7Z+KBHP72Wv8= +github.com/cloudwego/netpoll v0.2.4/go.mod h1:1T2WVuQ+MQw6h6DpE45MohSvDTKdy2DlzCx2KsnPI4E= +github.com/cloudwego/netpoll v0.3.1/go.mod h1:1T2WVuQ+MQw6h6DpE45MohSvDTKdy2DlzCx2KsnPI4E= +github.com/cloudwego/netpoll v0.4.0/go.mod h1:xVefXptcyheopwNDZjDPcfU6kIjZXZ4nY550k1yH9eQ= +github.com/cloudwego/netpoll v0.5.1 h1:zDUF7xF0C97I10fGlQFJ4jg65khZZMUvSu/TWX44Ohc= +github.com/cloudwego/netpoll v0.5.1/go.mod h1:xVefXptcyheopwNDZjDPcfU6kIjZXZ4nY550k1yH9eQ= +github.com/cloudwego/thriftgo v0.1.2/go.mod h1:LzeafuLSiHA9JTiWC8TIMIq64iadeObgRUhmVG1OC/w= +github.com/cloudwego/thriftgo v0.2.4/go.mod h1:8i9AF5uDdWHGqzUhXDlubCjx4MEfKvWXGQlMWyR0tM4= +github.com/cloudwego/thriftgo v0.2.7/go.mod h1:8i9AF5uDdWHGqzUhXDlubCjx4MEfKvWXGQlMWyR0tM4= +github.com/cloudwego/thriftgo v0.2.11/go.mod h1:dAyXHEmKXo0LfMCrblVEY3mUZsdeuA5+i0vF5f09j7E= +github.com/cloudwego/thriftgo v0.3.3 h1:dqdB5wXnw9icTXdb+/13dVZhSEf83UVsa75Yr05vTVE= +github.com/cloudwego/thriftgo v0.3.3/go.mod h1:29ukiySoAMd0vXMYIduAY9dph/7dmChvOS11YLotFb8= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/dlclark/regexp2 v1.10.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= +github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= +github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/go-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g= +github.com/go-fonts/latin-modern v0.2.0/go.mod h1:rQVLdDMK+mK1xscDwsqM5J8U2jrRa3T0ecnM9pNujks= +github.com/go-fonts/liberation v0.1.1/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= +github.com/go-fonts/liberation v0.2.0/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= +github.com/go-fonts/stix v0.1.0/go.mod h1:w/c1f0ldAUlJmLBvlbkvVXLAD+tAMqobIIQpmnUIzUY= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-latex/latex v0.0.0-20210118124228-b3d85cf34e07/go.mod h1:CO1AlKB2CSIqUrmQPqA0gdRIlnLEY0gK5JGjh37zN5U= +github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81/go.mod h1:SX0U8uGpxhq9o2S/CELCSUxEWWAuoCUcVCQWv7G2OCk= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= +github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= +github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= +github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20220608213341-c488b8fa1db3/go.mod h1:gSuNB+gJaOiQKLEZ+q+PK9Mq3SOzhRcw2GsGS/FhYDk= +github.com/google/pprof v0.0.0-20231212022811-ec68065c825e h1:bwOy7hAFd0C91URzMIEBfr6BAz29yk7Qj0cy6S7DJlU= +github.com/google/pprof v0.0.0-20231212022811-ec68065c825e/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= +github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0= +github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= +github.com/jhump/protoreflect v1.8.2 h1:k2xE7wcUomeqwY0LDCYA16y4WWfyTcMx5mKhk0d4ua0= +github.com/jhump/protoreflect v1.8.2/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= +github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kitex-contrib/obs-opentelemetry/logging/logrus v0.0.0-20231211030816-1f9e0f7bcee3 h1:BvoAn9lMaQNkWLDrR1wTrQsnOoLbMuGgr994sAwZT8s= +github.com/kitex-contrib/obs-opentelemetry/logging/logrus v0.0.0-20231211030816-1f9e0f7bcee3/go.mod h1:oQTDyY/+vIlKG/9FGhtYASfb+UybIiianqn1RLVhJ3A= +github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4= +github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.1.0/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= +github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= +github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= +github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/gls v0.0.0-20220109145502-612d0167dce5 h1:uiS4zKYKJVj5F3ID+5iylfKPsEQmBEOucSD9Vgmn0i0= +github.com/modern-go/gls v0.0.0-20220109145502-612d0167dce5/go.mod h1:I8AX+yW//L8Hshx6+a1m3bYkwXkpsVjA2795vP4f4oQ= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/nats-io/nats.go v1.31.0 h1:/WFBHEc/dOKBF6qf1TZhrdEfTmOZ5JzdJ+Y3m6Y/p7E= +github.com/nats-io/nats.go v1.31.0/go.mod h1:di3Bm5MLsoB4Bx61CBTsxuarI36WbhAwOm8QrW39+i8= +github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI= +github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc= +github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= +github.com/oleiade/lane v1.0.1 h1:hXofkn7GEOubzTwNpeL9MaNy8WxolCYb9cInAIeqShU= +github.com/oleiade/lane v1.0.1/go.mod h1:IyTkraa4maLfjq/GmHR+Dxb4kCMtEGeb+qmhlrQ5Mk4= +github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= +github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= +github.com/phpdave11/gofpdi v1.0.13/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= +github.com/redis/go-redis/v9 v9.3.1 h1:KqdY8U+3X6z+iACvumCNxnoluToB+9Me+TvyFa21Mds= +github.com/redis/go-redis/v9 v9.3.1/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= +github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/thrift-iterator/go v0.0.0-20190402154806-9b5a67519118/go.mod h1:60PRwE/TCI1UqLvn8v2pwAf6+yzTPLP/Ji5xaesWDqk= +github.com/tidwall/gjson v1.9.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM= +github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= +github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= +github.com/v2pro/plz v0.0.0-20221028024117-e5f9aec5b631/go.mod h1:3gacX+hQo+xvl0vtLqCMufzxuNCwt4geAVOMt2LQYfE= +github.com/v2pro/quokka v0.0.0-20171201153428-382cb39c6ee6/go.mod h1:0VP5W9AFNVWU8C1QLNeVg8TvzoEkIHWZ4vxtxEVFWUY= +github.com/v2pro/wombat v0.0.0-20180402055224-a56dbdcddef2/go.mod h1:wen8nMxrRrUmXnRwH+3wGAW+hyYTHcOrTNhMpxyp/i0= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0 h1:+XWJd3jf75RXJq29mxbuXhCXFDG3S3R4vBUeSI2P7tE= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0/go.mod h1:hqgzBPTf4yONMFgdZvL/bK42R/iinTyVQtiWihs3SZc= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= +go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= +golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.0.0-20220722155209-00200b7164a7/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.2.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.6.0 h1:S0JTfE48HbRj80+4tbvZDYsJ3tGv6BUU3XxyZ7CirAc= +golang.org/x/arch v0.6.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3/go.mod h1:NOZ3BPKG0ec/BKJQgnvsSFpcKLM5xXVWnvZS97DWHgE= +golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20210216034530-4410531fe030/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= +golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= +golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= +golang.org/x/image v0.0.0-20220302094943-723b81ca9867/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210818153620-00dd8d7831e7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220110181412-a018aaa089fe/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220817070843-5a390386f1f2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190927191325-030b2cf1153e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= +gonum.org/v1/gonum v0.9.3/go.mod h1:TZumC3NeyVQskjXqmyWt4S3bINhy7B4eYwW69EbyX+0= +gonum.org/v1/gonum v0.12.0/go.mod h1:73TDxJfAAHeA8Mk9mf8NlIppyhQNo5GLTcYeqgo2lvY= +gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= +gonum.org/v1/plot v0.9.0/go.mod h1:3Pcqqmp6RHvJI72kgb8fThyUnav364FOsdDo2aGW5lY= +gonum.org/v1/plot v0.10.1/go.mod h1:VZW5OlhkL1mysU9vaqNHnsy86inf6Ot+jB3r+BczCEo= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 h1:1hfbdAfFbkmpg41000wDVqr7jUpK/Yo+LPnIxxGzmkg= +google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3/go.mod h1:5RBcpGRxr25RbDzY5w+dmaqpSEvl8Gwl1x2CICf60ic= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 h1:/jFB8jK5R3Sq3i/lmeZO0cATSzFfZaJq1J2Euan3XKU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0/go.mod h1:FUoWkonphQm3RhTS+kOEhF8h0iDpm4tdXolVCeZ9KKA= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= +gopkg.in/validator.v2 v2.0.1 h1:xF0KWyGWXm/LM2G1TrEjqOu4pa6coO9AlWSf3msVfDY= +gopkg.in/validator.v2 v2.0.1/go.mod h1:lIUZBlB3Im4s/eYp39Ry/wkR02yOPhZ9IwIRBjuPuG8= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/driver/mysql v1.5.2 h1:QC2HRskSE75wBuOxe0+iCkyJZ+RqpudsQtqkp+IMuXs= +gorm.io/driver/mysql v1.5.2/go.mod h1:pQLhh1Ut/WUAySdTHwBpBv6+JKcj+ua4ZFx1QQTBzb8= +gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= +gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls= +gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= +nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/gomall/app/email/handler.go b/gomall/app/email/handler.go new file mode 100644 index 00000000..efd0d782 --- /dev/null +++ b/gomall/app/email/handler.go @@ -0,0 +1,18 @@ +package main + +import ( + "context" + + "github.com/cloudwego/biz-demo/gomall/app/email/biz/service" + email "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/email" +) + +// EmailServiceImpl implements the last service interface defined in the IDL. +type EmailServiceImpl struct{} + +// Send implements the EmailServiceImpl interface. +func (s *EmailServiceImpl) Send(ctx context.Context, req *email.EmailReq) (resp *email.EmailResp, err error) { + resp, err = service.NewSendService(ctx).Run(req) + + return resp, err +} diff --git a/gomall/app/email/infra/mq/nats.go b/gomall/app/email/infra/mq/nats.go new file mode 100644 index 00000000..e926a9b8 --- /dev/null +++ b/gomall/app/email/infra/mq/nats.go @@ -0,0 +1,17 @@ +package mq + +import ( + "github.com/nats-io/nats.go" +) + +var ( + Nc *nats.Conn + err error +) + +func Init() { + Nc, err = nats.Connect(nats.DefaultURL) + if err != nil { + panic(err) + } +} diff --git a/gomall/app/email/infra/mtl/log.go b/gomall/app/email/infra/mtl/log.go new file mode 100644 index 00000000..489f3711 --- /dev/null +++ b/gomall/app/email/infra/mtl/log.go @@ -0,0 +1,49 @@ +// Copyright 2024 CloudWeGo Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package mtl + +import ( + "os" + "time" + + "github.com/cloudwego/kitex/pkg/klog" + "github.com/cloudwego/kitex/server" + kitexzap "github.com/kitex-contrib/obs-opentelemetry/logging/zap" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" +) + +func initLog() { + var opts []kitexzap.Option + var output zapcore.WriteSyncer + if os.Getenv("GO_ENV") != "online" { + opts = append(opts, kitexzap.WithCoreEnc(zapcore.NewConsoleEncoder(zap.NewDevelopmentEncoderConfig()))) + output = os.Stdout + } else { + opts = append(opts, kitexzap.WithCoreEnc(zapcore.NewJSONEncoder(zap.NewProductionEncoderConfig()))) + // async log + output = &zapcore.BufferedWriteSyncer{ + WS: zapcore.AddSync(os.Stdout), + FlushInterval: time.Minute, + } + server.RegisterShutdownHook(func() { + output.Sync() //nolint:errcheck + }) + } + log := kitexzap.NewLogger(opts...) + klog.SetLogger(log) + klog.SetLevel(klog.LevelTrace) + klog.SetOutput(output) +} diff --git a/gomall/app/email/infra/mtl/metric.go b/gomall/app/email/infra/mtl/metric.go new file mode 100644 index 00000000..454ab5d3 --- /dev/null +++ b/gomall/app/email/infra/mtl/metric.go @@ -0,0 +1,56 @@ +// Copyright 2024 CloudWeGo Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package mtl + +import ( + "net" + "net/http" + + "github.com/cloudwego/biz-demo/gomall/app/cart/conf" + "github.com/cloudwego/kitex/pkg/registry" + "github.com/cloudwego/kitex/server" + consul "github.com/kitex-contrib/registry-consul" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/collectors" + "github.com/prometheus/client_golang/prometheus/promhttp" +) + +var Registry *prometheus.Registry + +func initMetric() { + Registry = prometheus.NewRegistry() + Registry.MustRegister(collectors.NewGoCollector()) + Registry.MustRegister(collectors.NewProcessCollector(collectors.ProcessCollectorOpts{})) + + r, _ := consul.NewConsulRegister(conf.GetConf().Registry.RegistryAddress[0]) + + addr, _ := net.ResolveTCPAddr("tcp", conf.GetConf().Kitex.MetricsPort) + + registryInfo := ®istry.Info{ + ServiceName: "prometheus", + Addr: addr, + Weight: 1, + Tags: map[string]string{"service": conf.GetConf().Kitex.Service}, + } + + _ = r.Register(registryInfo) + + server.RegisterShutdownHook(func() { + r.Deregister(registryInfo) //nolint:errcheck + }) + + http.Handle("/metrics", promhttp.HandlerFor(Registry, promhttp.HandlerOpts{})) + go http.ListenAndServe(conf.GetConf().Kitex.MetricsPort, nil) //nolint:errcheck +} diff --git a/gomall/app/email/infra/mtl/mtl.go b/gomall/app/email/infra/mtl/mtl.go new file mode 100644 index 00000000..e2bc3c11 --- /dev/null +++ b/gomall/app/email/infra/mtl/mtl.go @@ -0,0 +1,29 @@ +// Copyright 2024 CloudWeGo Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package mtl + +import "sync" + +var once sync.Once + +func InitMtl() { + once.Do( + func() { + initTracing() + initMetric() + initLog() + }, + ) +} diff --git a/gomall/app/email/infra/mtl/tracing.go b/gomall/app/email/infra/mtl/tracing.go new file mode 100644 index 00000000..af263b34 --- /dev/null +++ b/gomall/app/email/infra/mtl/tracing.go @@ -0,0 +1,49 @@ +// Copyright 2024 CloudWeGo Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package mtl + +import ( + "context" + + "github.com/cloudwego/biz-demo/gomall/app/cart/conf" + "github.com/cloudwego/kitex/server" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" + "go.opentelemetry.io/otel/sdk/resource" + tracesdk "go.opentelemetry.io/otel/sdk/trace" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" +) + +var TracerProvider *tracesdk.TracerProvider + +func initTracing() { + exporter, err := otlptracegrpc.New(context.Background()) + if err != nil { + panic(err) + } + server.RegisterShutdownHook(func() { + _ = exporter.Shutdown(context.Background()) + }) + processor := tracesdk.NewBatchSpanProcessor(exporter) + res, err := resource.New(context.Background(), resource.WithAttributes(semconv.ServiceNameKey.String(conf.GetConf().Kitex.Service))) + if err != nil { + res = resource.Default() + } + TracerProvider = tracesdk.NewTracerProvider(tracesdk.WithSpanProcessor(processor), tracesdk.WithResource(res)) + server.RegisterShutdownHook(func() { + _ = TracerProvider.Shutdown(context.Background()) + }) + otel.SetTracerProvider(TracerProvider) +} diff --git a/gomall/app/email/kitex_info.yaml b/gomall/app/email/kitex_info.yaml new file mode 100644 index 00000000..e148de6a --- /dev/null +++ b/gomall/app/email/kitex_info.yaml @@ -0,0 +1,3 @@ +kitexinfo: + ServiceName: 'email' + ToolVersion: 'v0.8.0' diff --git a/gomall/app/email/main.go b/gomall/app/email/main.go new file mode 100644 index 00000000..65325f8e --- /dev/null +++ b/gomall/app/email/main.go @@ -0,0 +1,43 @@ +package main + +import ( + "net" + + "github.com/cloudwego/biz-demo/gomall/app/cart/infra/mtl" + "github.com/cloudwego/biz-demo/gomall/app/email/biz/consumer" + "github.com/cloudwego/biz-demo/gomall/app/email/conf" + "github.com/cloudwego/biz-demo/gomall/app/email/infra/mq" + "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/email/emailservice" + "github.com/cloudwego/kitex/pkg/klog" + "github.com/cloudwego/kitex/pkg/rpcinfo" + "github.com/cloudwego/kitex/server" +) + +func main() { + opts := kitexInit() + + mtl.InitMtl() + mq.Init() + consumer.Init() + svr := emailservice.NewServer(new(EmailServiceImpl), opts...) + + err := svr.Run() + if err != nil { + klog.Error(err.Error()) + } +} + +func kitexInit() (opts []server.Option) { + // address + addr, err := net.ResolveTCPAddr("tcp", conf.GetConf().Kitex.Address) + if err != nil { + panic(err) + } + opts = append(opts, server.WithServiceAddr(addr)) + + // service info + opts = append(opts, server.WithServerBasicInfo(&rpcinfo.EndpointBasicInfo{ + ServiceName: conf.GetConf().Kitex.Service, + })) + return +} diff --git a/gomall/app/email/readme.md b/gomall/app/email/readme.md new file mode 100644 index 00000000..f25d9fbe --- /dev/null +++ b/gomall/app/email/readme.md @@ -0,0 +1,26 @@ +# *** Project + +## introduce + +- Use the [Kitex](https://github.com/cloudwego/kitex/) framework +- Generating the base code for unit tests. +- Provides basic config functions +- Provides the most basic MVC code hierarchy. + +## Directory structure + +| catalog | introduce | +| ---- | ---- | +| conf | Configuration files | +| main.go | Startup file | +| handler.go | Used for request processing return of response. | +| kitex_gen | kitex generated code | +| biz/service | The actual business logic. | +| biz/dal | Logic for operating the storage layer | + +## How to run + +```shell +sh build.sh +sh output/bootstrap.sh +``` diff --git a/gomall/app/email/script/bootstrap.sh b/gomall/app/email/script/bootstrap.sh new file mode 100644 index 00000000..7bdfdef0 --- /dev/null +++ b/gomall/app/email/script/bootstrap.sh @@ -0,0 +1,4 @@ +#! /usr/bin/env bash +CURDIR=$(cd $(dirname $0); pwd) +echo "$CURDIR/bin/email" +exec "$CURDIR/bin/email" diff --git a/gomall/app/order/go.mod b/gomall/app/order/go.mod index 2562c737..8dbb13fe 100644 --- a/gomall/app/order/go.mod +++ b/gomall/app/order/go.mod @@ -8,7 +8,6 @@ replace github.com/cloudwego/biz-demo/gomall/rpc_gen => ../../rpc_gen require ( github.com/cloudwego/biz-demo/gomall/rpc_gen v0.0.0-00010101000000-000000000000 - github.com/cloudwego/fastpb v0.0.4 github.com/cloudwego/kitex v0.8.0 github.com/google/uuid v1.5.0 github.com/joho/godotenv v1.5.1 @@ -24,7 +23,6 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 go.opentelemetry.io/otel/sdk v1.21.0 go.uber.org/zap v1.26.0 - google.golang.org/protobuf v1.32.0 gopkg.in/validator.v2 v2.0.1 gopkg.in/yaml.v2 v2.4.0 gorm.io/driver/mysql v1.5.2 @@ -44,6 +42,7 @@ require ( github.com/choleraehyq/pid v0.0.17 // indirect github.com/cloudwego/configmanager v0.2.0 // indirect github.com/cloudwego/dynamicgo v0.1.6 // indirect + github.com/cloudwego/fastpb v0.0.4 // indirect github.com/cloudwego/frugal v0.1.12 // indirect github.com/cloudwego/localsession v0.0.2 // indirect github.com/cloudwego/netpoll v0.5.1 // indirect @@ -120,5 +119,6 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect google.golang.org/grpc v1.59.0 // indirect + google.golang.org/protobuf v1.32.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/gomall/app/payment/go.mod b/gomall/app/payment/go.mod index 0948c6d9..de45593d 100644 --- a/gomall/app/payment/go.mod +++ b/gomall/app/payment/go.mod @@ -8,7 +8,6 @@ replace github.com/cloudwego/biz-demo/gomall/rpc_gen => ../../rpc_gen require ( github.com/cloudwego/biz-demo/gomall/rpc_gen v0.0.0-00010101000000-000000000000 - github.com/cloudwego/fastpb v0.0.4 github.com/cloudwego/kitex v0.8.0 github.com/durango/go-credit-card v0.0.0-20220404131259-a9e175ba4082 github.com/google/uuid v1.5.0 @@ -25,7 +24,6 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 go.opentelemetry.io/otel/sdk v1.21.0 go.uber.org/zap v1.26.0 - google.golang.org/protobuf v1.32.0 gopkg.in/validator.v2 v2.0.1 gopkg.in/yaml.v2 v2.4.0 gorm.io/driver/mysql v1.5.2 @@ -45,6 +43,7 @@ require ( github.com/choleraehyq/pid v0.0.17 // indirect github.com/cloudwego/configmanager v0.2.0 // indirect github.com/cloudwego/dynamicgo v0.1.6 // indirect + github.com/cloudwego/fastpb v0.0.4 // indirect github.com/cloudwego/frugal v0.1.12 // indirect github.com/cloudwego/localsession v0.0.2 // indirect github.com/cloudwego/netpoll v0.5.1 // indirect @@ -121,5 +120,6 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect google.golang.org/grpc v1.59.0 // indirect + google.golang.org/protobuf v1.32.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/gomall/app/product/go.mod b/gomall/app/product/go.mod index 73aab902..260117e2 100644 --- a/gomall/app/product/go.mod +++ b/gomall/app/product/go.mod @@ -8,7 +8,6 @@ replace github.com/cloudwego/biz-demo/gomall/rpc_gen => ../../rpc_gen require ( github.com/cloudwego/biz-demo/gomall/rpc_gen v0.0.0-00010101000000-000000000000 - github.com/cloudwego/fastpb v0.0.4 github.com/cloudwego/kitex v0.8.0 github.com/joho/godotenv v1.5.1 github.com/kitex-contrib/config-etcd v0.1.0 @@ -25,7 +24,6 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 go.opentelemetry.io/otel/sdk v1.21.0 go.uber.org/zap v1.26.0 - google.golang.org/protobuf v1.32.0 gopkg.in/validator.v2 v2.0.1 gopkg.in/yaml.v2 v2.4.0 gorm.io/driver/mysql v1.5.2 @@ -46,6 +44,7 @@ require ( github.com/choleraehyq/pid v0.0.17 // indirect github.com/cloudwego/configmanager v0.2.0 // indirect github.com/cloudwego/dynamicgo v0.1.6 // indirect + github.com/cloudwego/fastpb v0.0.4 // indirect github.com/cloudwego/frugal v0.1.12 // indirect github.com/cloudwego/localsession v0.0.2 // indirect github.com/cloudwego/netpoll v0.5.1 // indirect @@ -123,5 +122,6 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect google.golang.org/grpc v1.59.0 // indirect + google.golang.org/protobuf v1.32.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/gomall/app/user/go.mod b/gomall/app/user/go.mod index 2534cb0a..9e17d3c8 100644 --- a/gomall/app/user/go.mod +++ b/gomall/app/user/go.mod @@ -8,7 +8,6 @@ replace github.com/cloudwego/biz-demo/gomall/rpc_gen => ../../rpc_gen require ( github.com/cloudwego/biz-demo/gomall/rpc_gen v0.0.0-00010101000000-000000000000 - github.com/cloudwego/fastpb v0.0.4 github.com/cloudwego/kitex v0.8.0 github.com/joho/godotenv v1.5.1 github.com/kitex-contrib/config-etcd v0.1.0 @@ -24,7 +23,6 @@ require ( go.opentelemetry.io/otel/sdk v1.21.0 go.uber.org/zap v1.26.0 golang.org/x/crypto v0.17.0 - google.golang.org/protobuf v1.32.0 gopkg.in/validator.v2 v2.0.1 gopkg.in/yaml.v2 v2.4.0 gorm.io/driver/mysql v1.5.2 @@ -44,6 +42,7 @@ require ( github.com/choleraehyq/pid v0.0.17 // indirect github.com/cloudwego/configmanager v0.2.0 // indirect github.com/cloudwego/dynamicgo v0.1.6 // indirect + github.com/cloudwego/fastpb v0.0.4 // indirect github.com/cloudwego/frugal v0.1.12 // indirect github.com/cloudwego/localsession v0.0.2 // indirect github.com/cloudwego/netpoll v0.5.1 // indirect @@ -120,5 +119,6 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect google.golang.org/grpc v1.59.0 // indirect + google.golang.org/protobuf v1.32.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/gomall/common/go.mod b/gomall/common/go.mod index e18abf32..f4b1d75f 100644 --- a/gomall/common/go.mod +++ b/gomall/common/go.mod @@ -5,6 +5,7 @@ go 1.21 require ( github.com/cloudwego/kitex v0.8.0 github.com/kitex-contrib/registry-consul v0.0.0-20230406075225-7d341f036654 + google.golang.org/protobuf v1.32.0 ) require ( @@ -65,7 +66,6 @@ require ( golang.org/x/text v0.14.0 // indirect google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect - google.golang.org/protobuf v1.32.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/gomall/go.work b/gomall/go.work index 7f2cbd29..bd9c22e9 100644 --- a/gomall/go.work +++ b/gomall/go.work @@ -1,14 +1,16 @@ -go 1.21 +go 1.21.5 use ( ./app/cart ./app/checkout + ./app/email ./app/frontend ./app/order ./app/payment ./app/product ./app/user ./common + rpc_gen ) replace github.com/apache/thrift => github.com/apache/thrift v0.13.0 diff --git a/gomall/go.work.sum b/gomall/go.work.sum index 4e4e6a9b..0046ea67 100644 --- a/gomall/go.work.sum +++ b/gomall/go.work.sum @@ -871,7 +871,6 @@ github.com/lyft/protoc-gen-star/v2 v2.0.3/go.mod h1:amey7yeodaJhXSbf/TlLvWiqQfLO github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA= -github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 h1:AMFGa4R4MiIpspGNG7Z948v4n35fFGB3RR3G/ry4FWs= @@ -899,8 +898,6 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245 h1:K1Xf3bKttbF+koVGaX5xngRIZ5bVjbmPnaxE/dR08uY= github.com/ryanuber/columnize v2.1.0+incompatible h1:j1Wcmh8OrK4Q7GXY+V7SVSY8nUWQxHW5TkBe7YUl+2s= github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= -github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y= -github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/afero v1.3.3 h1:p5gZEKLYoL7wh8VrJesMaYeNxdEd1v3cb4irOk9zB54= github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= @@ -946,8 +943,6 @@ golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= -golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= -golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3 h1:n9HxLrNxWWtEb1cA950nuEEj3QnKbtsCJ6KjcgisNUs= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 h1:QE6XYQK6naiK1EPAe1g/ILLxN5RBoH5xkJk3CqlMI/Y= golang.org/x/image v0.0.0-20220302094943-723b81ca9867 h1:TcHcE0vrmgzNH1v3ppjcMGbhG5+9fMuvOmUYwNEF4q4= @@ -958,6 +953,7 @@ golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= @@ -1054,7 +1050,6 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQ gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gorm.io/driver/sqlite v1.5.0/go.mod h1:kDMDfntV9u/vuMmz8APHtHF0b4nyBB7sfCieC6G8k8I= honnef.co/go/tools v0.1.3 h1:qTakTkI6ni6LFD5sBwwsdSO+AQqbSIxOauHTTQKZ/7o= nullprogram.com/x/optparse v1.0.0 h1:xGFgVi5ZaWOnYdac2foDT3vg0ZZC9ErXFV57mr4OHrI= rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE= diff --git a/gomall/idl/email.proto b/gomall/idl/email.proto new file mode 100644 index 00000000..62d0d5d4 --- /dev/null +++ b/gomall/idl/email.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package email; + +option go_package = "/email"; + +message EmailReq{ + string from = 1; + string to = 2; + string content_type = 3; + string subject = 4; + string content = 5; +} + +message EmailResp { + +} + +service EmailService{ + rpc Send(EmailReq) returns (EmailResp); +} \ No newline at end of file diff --git a/gomall/rpc_gen/kitex_gen/email/email.pb.fast.go b/gomall/rpc_gen/kitex_gen/email/email.pb.fast.go new file mode 100644 index 00000000..f637077a --- /dev/null +++ b/gomall/rpc_gen/kitex_gen/email/email.pb.fast.go @@ -0,0 +1,219 @@ +// Code generated by Fastpb v0.0.2. DO NOT EDIT. + +package email + +import ( + fmt "fmt" + fastpb "github.com/cloudwego/fastpb" +) + +var ( + _ = fmt.Errorf + _ = fastpb.Skip +) + +func (x *EmailReq) FastRead(buf []byte, _type int8, number int32) (offset int, err error) { + switch number { + case 1: + offset, err = x.fastReadField1(buf, _type) + if err != nil { + goto ReadFieldError + } + case 2: + offset, err = x.fastReadField2(buf, _type) + if err != nil { + goto ReadFieldError + } + case 3: + offset, err = x.fastReadField3(buf, _type) + if err != nil { + goto ReadFieldError + } + case 4: + offset, err = x.fastReadField4(buf, _type) + if err != nil { + goto ReadFieldError + } + case 5: + offset, err = x.fastReadField5(buf, _type) + if err != nil { + goto ReadFieldError + } + default: + offset, err = fastpb.Skip(buf, _type, number) + if err != nil { + goto SkipFieldError + } + } + return offset, nil +SkipFieldError: + return offset, fmt.Errorf("%T cannot parse invalid wire-format data, error: %s", x, err) +ReadFieldError: + return offset, fmt.Errorf("%T read field %d '%s' error: %s", x, number, fieldIDToName_EmailReq[number], err) +} + +func (x *EmailReq) fastReadField1(buf []byte, _type int8) (offset int, err error) { + x.From, offset, err = fastpb.ReadString(buf, _type) + return offset, err +} + +func (x *EmailReq) fastReadField2(buf []byte, _type int8) (offset int, err error) { + x.To, offset, err = fastpb.ReadString(buf, _type) + return offset, err +} + +func (x *EmailReq) fastReadField3(buf []byte, _type int8) (offset int, err error) { + x.ContentType, offset, err = fastpb.ReadString(buf, _type) + return offset, err +} + +func (x *EmailReq) fastReadField4(buf []byte, _type int8) (offset int, err error) { + x.Subject, offset, err = fastpb.ReadString(buf, _type) + return offset, err +} + +func (x *EmailReq) fastReadField5(buf []byte, _type int8) (offset int, err error) { + x.Content, offset, err = fastpb.ReadString(buf, _type) + return offset, err +} + +func (x *EmailResp) FastRead(buf []byte, _type int8, number int32) (offset int, err error) { + switch number { + default: + offset, err = fastpb.Skip(buf, _type, number) + if err != nil { + goto SkipFieldError + } + } + return offset, nil +SkipFieldError: + return offset, fmt.Errorf("%T cannot parse invalid wire-format data, error: %s", x, err) +} + +func (x *EmailReq) FastWrite(buf []byte) (offset int) { + if x == nil { + return offset + } + offset += x.fastWriteField1(buf[offset:]) + offset += x.fastWriteField2(buf[offset:]) + offset += x.fastWriteField3(buf[offset:]) + offset += x.fastWriteField4(buf[offset:]) + offset += x.fastWriteField5(buf[offset:]) + return offset +} + +func (x *EmailReq) fastWriteField1(buf []byte) (offset int) { + if x.From == "" { + return offset + } + offset += fastpb.WriteString(buf[offset:], 1, x.GetFrom()) + return offset +} + +func (x *EmailReq) fastWriteField2(buf []byte) (offset int) { + if x.To == "" { + return offset + } + offset += fastpb.WriteString(buf[offset:], 2, x.GetTo()) + return offset +} + +func (x *EmailReq) fastWriteField3(buf []byte) (offset int) { + if x.ContentType == "" { + return offset + } + offset += fastpb.WriteString(buf[offset:], 3, x.GetContentType()) + return offset +} + +func (x *EmailReq) fastWriteField4(buf []byte) (offset int) { + if x.Subject == "" { + return offset + } + offset += fastpb.WriteString(buf[offset:], 4, x.GetSubject()) + return offset +} + +func (x *EmailReq) fastWriteField5(buf []byte) (offset int) { + if x.Content == "" { + return offset + } + offset += fastpb.WriteString(buf[offset:], 5, x.GetContent()) + return offset +} + +func (x *EmailResp) FastWrite(buf []byte) (offset int) { + if x == nil { + return offset + } + return offset +} + +func (x *EmailReq) Size() (n int) { + if x == nil { + return n + } + n += x.sizeField1() + n += x.sizeField2() + n += x.sizeField3() + n += x.sizeField4() + n += x.sizeField5() + return n +} + +func (x *EmailReq) sizeField1() (n int) { + if x.From == "" { + return n + } + n += fastpb.SizeString(1, x.GetFrom()) + return n +} + +func (x *EmailReq) sizeField2() (n int) { + if x.To == "" { + return n + } + n += fastpb.SizeString(2, x.GetTo()) + return n +} + +func (x *EmailReq) sizeField3() (n int) { + if x.ContentType == "" { + return n + } + n += fastpb.SizeString(3, x.GetContentType()) + return n +} + +func (x *EmailReq) sizeField4() (n int) { + if x.Subject == "" { + return n + } + n += fastpb.SizeString(4, x.GetSubject()) + return n +} + +func (x *EmailReq) sizeField5() (n int) { + if x.Content == "" { + return n + } + n += fastpb.SizeString(5, x.GetContent()) + return n +} + +func (x *EmailResp) Size() (n int) { + if x == nil { + return n + } + return n +} + +var fieldIDToName_EmailReq = map[int32]string{ + 1: "From", + 2: "To", + 3: "ContentType", + 4: "Subject", + 5: "Content", +} + +var fieldIDToName_EmailResp = map[int32]string{} diff --git a/gomall/rpc_gen/kitex_gen/email/email.pb.go b/gomall/rpc_gen/kitex_gen/email/email.pb.go new file mode 100644 index 00000000..91137b08 --- /dev/null +++ b/gomall/rpc_gen/kitex_gen/email/email.pb.go @@ -0,0 +1,249 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v4.22.0 +// source: email.proto + +package email + +import ( + context "context" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type EmailReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` + To string `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"` + ContentType string `protobuf:"bytes,3,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` + Subject string `protobuf:"bytes,4,opt,name=subject,proto3" json:"subject,omitempty"` + Content string `protobuf:"bytes,5,opt,name=content,proto3" json:"content,omitempty"` +} + +func (x *EmailReq) Reset() { + *x = EmailReq{} + if protoimpl.UnsafeEnabled { + mi := &file_email_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EmailReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EmailReq) ProtoMessage() {} + +func (x *EmailReq) ProtoReflect() protoreflect.Message { + mi := &file_email_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EmailReq.ProtoReflect.Descriptor instead. +func (*EmailReq) Descriptor() ([]byte, []int) { + return file_email_proto_rawDescGZIP(), []int{0} +} + +func (x *EmailReq) GetFrom() string { + if x != nil { + return x.From + } + return "" +} + +func (x *EmailReq) GetTo() string { + if x != nil { + return x.To + } + return "" +} + +func (x *EmailReq) GetContentType() string { + if x != nil { + return x.ContentType + } + return "" +} + +func (x *EmailReq) GetSubject() string { + if x != nil { + return x.Subject + } + return "" +} + +func (x *EmailReq) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +type EmailResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *EmailResp) Reset() { + *x = EmailResp{} + if protoimpl.UnsafeEnabled { + mi := &file_email_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EmailResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EmailResp) ProtoMessage() {} + +func (x *EmailResp) ProtoReflect() protoreflect.Message { + mi := &file_email_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EmailResp.ProtoReflect.Descriptor instead. +func (*EmailResp) Descriptor() ([]byte, []int) { + return file_email_proto_rawDescGZIP(), []int{1} +} + +var File_email_proto protoreflect.FileDescriptor + +var file_email_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x22, 0x85, 0x01, 0x0a, 0x08, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, + 0x71, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x74, 0x6f, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x0b, 0x0a, 0x09, + 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x32, 0x39, 0x0a, 0x0c, 0x45, 0x6d, 0x61, + 0x69, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x29, 0x0a, 0x04, 0x53, 0x65, 0x6e, + 0x64, 0x12, 0x0f, 0x2e, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x2e, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, + 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x2e, 0x45, 0x6d, 0x61, 0x69, 0x6c, + 0x52, 0x65, 0x73, 0x70, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x77, 0x65, 0x67, 0x6f, 0x2f, 0x62, 0x69, 0x7a, + 0x2d, 0x64, 0x65, 0x6d, 0x6f, 0x2f, 0x67, 0x6f, 0x6d, 0x61, 0x6c, 0x6c, 0x2f, 0x72, 0x70, 0x63, + 0x5f, 0x67, 0x65, 0x6e, 0x2f, 0x6b, 0x69, 0x74, 0x65, 0x78, 0x5f, 0x67, 0x65, 0x6e, 0x2f, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_email_proto_rawDescOnce sync.Once + file_email_proto_rawDescData = file_email_proto_rawDesc +) + +func file_email_proto_rawDescGZIP() []byte { + file_email_proto_rawDescOnce.Do(func() { + file_email_proto_rawDescData = protoimpl.X.CompressGZIP(file_email_proto_rawDescData) + }) + return file_email_proto_rawDescData +} + +var file_email_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_email_proto_goTypes = []interface{}{ + (*EmailReq)(nil), // 0: email.EmailReq + (*EmailResp)(nil), // 1: email.EmailResp +} +var file_email_proto_depIdxs = []int32{ + 0, // 0: email.EmailService.Send:input_type -> email.EmailReq + 1, // 1: email.EmailService.Send:output_type -> email.EmailResp + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_email_proto_init() } +func file_email_proto_init() { + if File_email_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_email_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EmailReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_email_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EmailResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_email_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_email_proto_goTypes, + DependencyIndexes: file_email_proto_depIdxs, + MessageInfos: file_email_proto_msgTypes, + }.Build() + File_email_proto = out.File + file_email_proto_rawDesc = nil + file_email_proto_goTypes = nil + file_email_proto_depIdxs = nil +} + +var _ context.Context + +// Code generated by Kitex v0.8.0. DO NOT EDIT. + +type EmailService interface { + Send(ctx context.Context, req *EmailReq) (res *EmailResp, err error) +} diff --git a/gomall/rpc_gen/kitex_gen/email/emailservice/client.go b/gomall/rpc_gen/kitex_gen/email/emailservice/client.go new file mode 100644 index 00000000..ecb8df4d --- /dev/null +++ b/gomall/rpc_gen/kitex_gen/email/emailservice/client.go @@ -0,0 +1,49 @@ +// Code generated by Kitex v0.8.0. DO NOT EDIT. + +package emailservice + +import ( + "context" + email "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/email" + client "github.com/cloudwego/kitex/client" + callopt "github.com/cloudwego/kitex/client/callopt" +) + +// Client is designed to provide IDL-compatible methods with call-option parameter for kitex framework. +type Client interface { + Send(ctx context.Context, Req *email.EmailReq, callOptions ...callopt.Option) (r *email.EmailResp, err error) +} + +// NewClient creates a client for the service defined in IDL. +func NewClient(destService string, opts ...client.Option) (Client, error) { + var options []client.Option + options = append(options, client.WithDestService(destService)) + + options = append(options, opts...) + + kc, err := client.NewClient(serviceInfo(), options...) + if err != nil { + return nil, err + } + return &kEmailServiceClient{ + kClient: newServiceClient(kc), + }, nil +} + +// MustNewClient creates a client for the service defined in IDL. It panics if any error occurs. +func MustNewClient(destService string, opts ...client.Option) Client { + kc, err := NewClient(destService, opts...) + if err != nil { + panic(err) + } + return kc +} + +type kEmailServiceClient struct { + *kClient +} + +func (p *kEmailServiceClient) Send(ctx context.Context, Req *email.EmailReq, callOptions ...callopt.Option) (r *email.EmailResp, err error) { + ctx = client.NewCtxWithCallOptions(ctx, callOptions) + return p.kClient.Send(ctx, Req) +} diff --git a/gomall/rpc_gen/kitex_gen/email/emailservice/emailservice.go b/gomall/rpc_gen/kitex_gen/email/emailservice/emailservice.go new file mode 100644 index 00000000..0c39a789 --- /dev/null +++ b/gomall/rpc_gen/kitex_gen/email/emailservice/emailservice.go @@ -0,0 +1,212 @@ +// Code generated by Kitex v0.8.0. DO NOT EDIT. + +package emailservice + +import ( + "context" + email "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/email" + client "github.com/cloudwego/kitex/client" + kitex "github.com/cloudwego/kitex/pkg/serviceinfo" + streaming "github.com/cloudwego/kitex/pkg/streaming" + proto "google.golang.org/protobuf/proto" +) + +func serviceInfo() *kitex.ServiceInfo { + return emailServiceServiceInfo +} + +var emailServiceServiceInfo = NewServiceInfo() + +func NewServiceInfo() *kitex.ServiceInfo { + serviceName := "EmailService" + handlerType := (*email.EmailService)(nil) + methods := map[string]kitex.MethodInfo{ + "Send": kitex.NewMethodInfo(sendHandler, newSendArgs, newSendResult, false), + } + extra := map[string]interface{}{ + "PackageName": "email", + "ServiceFilePath": ``, + } + svcInfo := &kitex.ServiceInfo{ + ServiceName: serviceName, + HandlerType: handlerType, + Methods: methods, + PayloadCodec: kitex.Protobuf, + KiteXGenVersion: "v0.8.0", + Extra: extra, + } + return svcInfo +} + +func sendHandler(ctx context.Context, handler interface{}, arg, result interface{}) error { + switch s := arg.(type) { + case *streaming.Args: + st := s.Stream + req := new(email.EmailReq) + if err := st.RecvMsg(req); err != nil { + return err + } + resp, err := handler.(email.EmailService).Send(ctx, req) + if err != nil { + return err + } + if err := st.SendMsg(resp); err != nil { + return err + } + case *SendArgs: + success, err := handler.(email.EmailService).Send(ctx, s.Req) + if err != nil { + return err + } + realResult := result.(*SendResult) + realResult.Success = success + } + return nil +} +func newSendArgs() interface{} { + return &SendArgs{} +} + +func newSendResult() interface{} { + return &SendResult{} +} + +type SendArgs struct { + Req *email.EmailReq +} + +func (p *SendArgs) FastRead(buf []byte, _type int8, number int32) (n int, err error) { + if !p.IsSetReq() { + p.Req = new(email.EmailReq) + } + return p.Req.FastRead(buf, _type, number) +} + +func (p *SendArgs) FastWrite(buf []byte) (n int) { + if !p.IsSetReq() { + return 0 + } + return p.Req.FastWrite(buf) +} + +func (p *SendArgs) Size() (n int) { + if !p.IsSetReq() { + return 0 + } + return p.Req.Size() +} + +func (p *SendArgs) Marshal(out []byte) ([]byte, error) { + if !p.IsSetReq() { + return out, nil + } + return proto.Marshal(p.Req) +} + +func (p *SendArgs) Unmarshal(in []byte) error { + msg := new(email.EmailReq) + if err := proto.Unmarshal(in, msg); err != nil { + return err + } + p.Req = msg + return nil +} + +var SendArgs_Req_DEFAULT *email.EmailReq + +func (p *SendArgs) GetReq() *email.EmailReq { + if !p.IsSetReq() { + return SendArgs_Req_DEFAULT + } + return p.Req +} + +func (p *SendArgs) IsSetReq() bool { + return p.Req != nil +} + +func (p *SendArgs) GetFirstArgument() interface{} { + return p.Req +} + +type SendResult struct { + Success *email.EmailResp +} + +var SendResult_Success_DEFAULT *email.EmailResp + +func (p *SendResult) FastRead(buf []byte, _type int8, number int32) (n int, err error) { + if !p.IsSetSuccess() { + p.Success = new(email.EmailResp) + } + return p.Success.FastRead(buf, _type, number) +} + +func (p *SendResult) FastWrite(buf []byte) (n int) { + if !p.IsSetSuccess() { + return 0 + } + return p.Success.FastWrite(buf) +} + +func (p *SendResult) Size() (n int) { + if !p.IsSetSuccess() { + return 0 + } + return p.Success.Size() +} + +func (p *SendResult) Marshal(out []byte) ([]byte, error) { + if !p.IsSetSuccess() { + return out, nil + } + return proto.Marshal(p.Success) +} + +func (p *SendResult) Unmarshal(in []byte) error { + msg := new(email.EmailResp) + if err := proto.Unmarshal(in, msg); err != nil { + return err + } + p.Success = msg + return nil +} + +func (p *SendResult) GetSuccess() *email.EmailResp { + if !p.IsSetSuccess() { + return SendResult_Success_DEFAULT + } + return p.Success +} + +func (p *SendResult) SetSuccess(x interface{}) { + p.Success = x.(*email.EmailResp) +} + +func (p *SendResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *SendResult) GetResult() interface{} { + return p.Success +} + +type kClient struct { + c client.Client +} + +func newServiceClient(c client.Client) *kClient { + return &kClient{ + c: c, + } +} + +func (p *kClient) Send(ctx context.Context, Req *email.EmailReq) (r *email.EmailResp, err error) { + var _args SendArgs + _args.Req = Req + var _result SendResult + if err = p.c.Call(ctx, "Send", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} diff --git a/gomall/rpc_gen/kitex_gen/email/emailservice/invoker.go b/gomall/rpc_gen/kitex_gen/email/emailservice/invoker.go new file mode 100644 index 00000000..b262176e --- /dev/null +++ b/gomall/rpc_gen/kitex_gen/email/emailservice/invoker.go @@ -0,0 +1,24 @@ +// Code generated by Kitex v0.8.0. DO NOT EDIT. + +package emailservice + +import ( + email "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/email" + server "github.com/cloudwego/kitex/server" +) + +// NewInvoker creates a server.Invoker with the given handler and options. +func NewInvoker(handler email.EmailService, opts ...server.Option) server.Invoker { + var options []server.Option + + options = append(options, opts...) + + s := server.NewInvoker(options...) + if err := s.RegisterService(serviceInfo(), handler); err != nil { + panic(err) + } + if err := s.Init(); err != nil { + panic(err) + } + return s +} diff --git a/gomall/rpc_gen/kitex_gen/email/emailservice/server.go b/gomall/rpc_gen/kitex_gen/email/emailservice/server.go new file mode 100644 index 00000000..397262e7 --- /dev/null +++ b/gomall/rpc_gen/kitex_gen/email/emailservice/server.go @@ -0,0 +1,20 @@ +// Code generated by Kitex v0.8.0. DO NOT EDIT. +package emailservice + +import ( + email "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/email" + server "github.com/cloudwego/kitex/server" +) + +// NewServer creates a server.Server with the given handler and options. +func NewServer(handler email.EmailService, opts ...server.Option) server.Server { + var options []server.Option + + options = append(options, opts...) + + svr := server.NewServer(options...) + if err := svr.RegisterService(serviceInfo(), handler); err != nil { + panic(err) + } + return svr +} diff --git a/gomall/rpc_gen/rpc/email/email_client.go b/gomall/rpc_gen/rpc/email/email_client.go new file mode 100644 index 00000000..1eac3d0f --- /dev/null +++ b/gomall/rpc_gen/rpc/email/email_client.go @@ -0,0 +1,46 @@ +package email + +import ( + "context" + email "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/email" + + "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/email/emailservice" + "github.com/cloudwego/kitex/client" + "github.com/cloudwego/kitex/client/callopt" +) + +type RPCClient interface { + KitexClient() emailservice.Client + Service() string + Send(ctx context.Context, Req *email.EmailReq, callOptions ...callopt.Option) (r *email.EmailResp, err error) +} + +func NewRPCClient(dstService string, opts ...client.Option) (RPCClient, error) { + kitexClient, err := emailservice.NewClient(dstService, opts...) + if err != nil { + return nil, err + } + cli := &clientImpl{ + service: dstService, + kitexClient: kitexClient, + } + + return cli, nil +} + +type clientImpl struct { + service string + kitexClient emailservice.Client +} + +func (c *clientImpl) Service() string { + return c.service +} + +func (c *clientImpl) KitexClient() emailservice.Client { + return c.kitexClient +} + +func (c *clientImpl) Send(ctx context.Context, Req *email.EmailReq, callOptions ...callopt.Option) (r *email.EmailResp, err error) { + return c.kitexClient.Send(ctx, Req, callOptions...) +} diff --git a/gomall/rpc_gen/rpc/email/email_default.go b/gomall/rpc_gen/rpc/email/email_default.go new file mode 100644 index 00000000..1d8e158a --- /dev/null +++ b/gomall/rpc_gen/rpc/email/email_default.go @@ -0,0 +1,17 @@ +package email + +import ( + "context" + email "github.com/cloudwego/biz-demo/gomall/rpc_gen/kitex_gen/email" + "github.com/cloudwego/kitex/client/callopt" + "github.com/cloudwego/kitex/pkg/klog" +) + +func Send(ctx context.Context, req *email.EmailReq, callOptions ...callopt.Option) (resp *email.EmailResp, err error) { + resp, err = defaultClient.Send(ctx, req, callOptions...) + if err != nil { + klog.CtxErrorf(ctx, "Send call failed,err =%+v", err) + return nil, err + } + return resp, nil +} diff --git a/gomall/rpc_gen/rpc/email/email_init.go b/gomall/rpc_gen/rpc/email/email_init.go new file mode 100644 index 00000000..b7a299cd --- /dev/null +++ b/gomall/rpc_gen/rpc/email/email_init.go @@ -0,0 +1,40 @@ +package email + +import ( + "sync" + + "github.com/cloudwego/kitex/client" +) + +var ( + // todo edit custom config + defaultClient RPCClient + defaultDstService = "email" + defaultClientOpts = []client.Option{ + client.WithHostPorts("127.0.0.1:8888"), + } + once sync.Once +) + +func init() { + DefaultClient() +} + +func DefaultClient() RPCClient { + once.Do(func() { + defaultClient = newClient(defaultDstService, defaultClientOpts...) + }) + return defaultClient +} + +func newClient(dstService string, opts ...client.Option) RPCClient { + c, err := NewRPCClient(dstService, opts...) + if err != nil { + panic("failed to init client: " + err.Error()) + } + return c +} + +func InitClient(dstService string, opts ...client.Option) { + defaultClient = newClient(dstService, opts...) +}