update for latest micro changes #123
@ -1,3 +1,5 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
//go:generate protoc -I./proto -I. --go_out=paths=source_relative:./proto --go-micro_out=components=micro|grpc,standalone=true,debug=true,paths=source_relative:./micro proto/service.proto
|
//go:generate protoc -I./proto -I. --go_out=paths=source_relative:./proto proto/service.proto
|
||||||
|
//go:generate protoc -I./proto -I. --go-micro_out=components=micro,standalone=false,debug=true,paths=source_relative:./proto proto/service.proto
|
||||||
|
//go:generate protoc -I./proto -I. --go-micro_out=components=grpc,standalone=true,debug=true,paths=source_relative:./micro proto/service.proto
|
||||||
|
14
go.mod
14
go.mod
@ -3,8 +3,14 @@ module go.unistack.org/micro-config-service/v4
|
|||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/imdario/mergo v0.3.13
|
github.com/imdario/mergo v0.3.16
|
||||||
go.unistack.org/micro/v4 v4.0.1
|
go.unistack.org/micro-server-http/v4 v4.0.10
|
||||||
google.golang.org/grpc v1.52.3
|
go.unistack.org/micro/v4 v4.0.6
|
||||||
google.golang.org/protobuf v1.28.1
|
google.golang.org/protobuf v1.31.0
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/google/go-cmp v0.5.9 // indirect
|
||||||
|
github.com/google/uuid v1.3.0 // indirect
|
||||||
|
golang.org/x/net v0.14.0 // indirect
|
||||||
)
|
)
|
||||||
|
40
go.sum
40
go.sum
@ -1,32 +1,24 @@
|
|||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
|
||||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
|
||||||
github.com/google/go-cmp v0.5.5/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.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||||
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
|
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
|
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||||
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
|
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/silas/dag v0.0.0-20211117232152-9d50aa809f35/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
|
github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM=
|
||||||
go.unistack.org/micro-server-http/v3 v3.10.13 h1:rt50Hos9hSuyvyYEmw0p5L2eq7HDDz2GpAOUO6M0QC8=
|
github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
|
||||||
go.unistack.org/micro-server-http/v3 v3.10.13/go.mod h1:phNG9aosjbneXvZxEVaVQI+NHLLZ3eA82mOH6gGSShY=
|
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
|
||||||
go.unistack.org/micro/v3 v3.10.16 h1:2er/SKKYbV60M+UuJM4eYCF0MZYAIq/yNUrAbTfgq8Q=
|
go.unistack.org/micro-server-http/v4 v4.0.10 h1:y7ABAjX2yn2eOvCwGJH9htIHqLr2GVDyf6ObW5XGpsA=
|
||||||
go.unistack.org/micro/v3 v3.10.16/go.mod h1:uMAc0U/x7dmtICCrblGf0ZLgYegu3VwQAquu+OFCw1Q=
|
go.unistack.org/micro-server-http/v4 v4.0.10/go.mod h1:Cu4utVz2u98fychmjA2Ls6clXrja0sqH6Xu/JTamf7Y=
|
||||||
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
|
go.unistack.org/micro/v4 v4.0.1 h1:xo1IxbVfgh8i0eY0VeYa3cbb13u5n/Mxnp3FOgWD4Jo=
|
||||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
go.unistack.org/micro/v4 v4.0.6 h1:YFWvTh3VwyOd6NHYTQcf47n2TF5+p/EhpnbuBQX3qhk=
|
||||||
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
|
go.unistack.org/micro/v4 v4.0.6/go.mod h1:bVEYTlPi0EsdgZZt311bIroDg9ict7ky3C87dSCCAGk=
|
||||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
|
||||||
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
|
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
|
||||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c=
|
|
||||||
google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg=
|
|
||||||
google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ=
|
|
||||||
google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY=
|
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
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.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
|
||||||
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
|
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
||||||
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
|
||||||
// versions:
|
|
||||||
// - protoc-gen-go-micro v4.0.0
|
|
||||||
// - protoc v3.21.12
|
|
||||||
// source: service.proto
|
|
||||||
|
|
||||||
package servicepb
|
|
||||||
|
|
||||||
import (
|
|
||||||
context "context"
|
|
||||||
proto "go.unistack.org/micro-config-service/v4/proto"
|
|
||||||
v4 "go.unistack.org/micro-server-http/v4"
|
|
||||||
client "go.unistack.org/micro/v4/client"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
ConfigServiceName = "ConfigService"
|
|
||||||
)
|
|
||||||
var (
|
|
||||||
ConfigServiceServerEndpoints = []v4.EndpointMetadata{}
|
|
||||||
)
|
|
||||||
|
|
||||||
type ConfigServiceClient interface {
|
|
||||||
Load(ctx context.Context, req *proto.LoadRequest, opts ...client.CallOption) (*proto.LoadResponse, error)
|
|
||||||
Save(ctx context.Context, req *proto.SaveRequest, opts ...client.CallOption) (*proto.SaveResponse, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type ConfigServiceServer interface {
|
|
||||||
Load(ctx context.Context, req *proto.LoadRequest, rsp *proto.LoadResponse) error
|
|
||||||
Save(ctx context.Context, req *proto.SaveRequest, rsp *proto.SaveResponse) error
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
||||||
// protoc-gen-go-micro version: v4.0.0
|
// protoc-gen-go-micro version: v4.0.2
|
||||||
// source: service.proto
|
// source: service.proto
|
||||||
|
|
||||||
package servicepb
|
package servicepb
|
||||||
@ -8,6 +8,7 @@ import (
|
|||||||
context "context"
|
context "context"
|
||||||
proto "go.unistack.org/micro-config-service/v4/proto"
|
proto "go.unistack.org/micro-config-service/v4/proto"
|
||||||
client "go.unistack.org/micro/v4/client"
|
client "go.unistack.org/micro/v4/client"
|
||||||
|
options "go.unistack.org/micro/v4/options"
|
||||||
server "go.unistack.org/micro/v4/server"
|
server "go.unistack.org/micro/v4/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -16,11 +17,11 @@ type configServiceClient struct {
|
|||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConfigServiceClient(name string, c client.Client) ConfigServiceClient {
|
func NewConfigServiceClient(name string, c client.Client) proto.ConfigServiceClient {
|
||||||
return &configServiceClient{c: c, name: name}
|
return &configServiceClient{c: c, name: name}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *configServiceClient) Load(ctx context.Context, req *proto.LoadRequest, opts ...client.CallOption) (*proto.LoadResponse, error) {
|
func (c *configServiceClient) Load(ctx context.Context, req *proto.LoadRequest, opts ...options.Option) (*proto.LoadResponse, error) {
|
||||||
rsp := &proto.LoadResponse{}
|
rsp := &proto.LoadResponse{}
|
||||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "ConfigService.Load", req), rsp, opts...)
|
err := c.c.Call(ctx, c.c.NewRequest(c.name, "ConfigService.Load", req), rsp, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -29,7 +30,7 @@ func (c *configServiceClient) Load(ctx context.Context, req *proto.LoadRequest,
|
|||||||
return rsp, nil
|
return rsp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *configServiceClient) Save(ctx context.Context, req *proto.SaveRequest, opts ...client.CallOption) (*proto.SaveResponse, error) {
|
func (c *configServiceClient) Save(ctx context.Context, req *proto.SaveRequest, opts ...options.Option) (*proto.SaveResponse, error) {
|
||||||
rsp := &proto.SaveResponse{}
|
rsp := &proto.SaveResponse{}
|
||||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "ConfigService.Save", req), rsp, opts...)
|
err := c.c.Call(ctx, c.c.NewRequest(c.name, "ConfigService.Save", req), rsp, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -39,7 +40,7 @@ func (c *configServiceClient) Save(ctx context.Context, req *proto.SaveRequest,
|
|||||||
}
|
}
|
||||||
|
|
||||||
type configServiceServer struct {
|
type configServiceServer struct {
|
||||||
ConfigServiceServer
|
proto.ConfigServiceServer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *configServiceServer) Load(ctx context.Context, req *proto.LoadRequest, rsp *proto.LoadResponse) error {
|
func (h *configServiceServer) Load(ctx context.Context, req *proto.LoadRequest, rsp *proto.LoadResponse) error {
|
||||||
@ -50,7 +51,7 @@ func (h *configServiceServer) Save(ctx context.Context, req *proto.SaveRequest,
|
|||||||
return h.ConfigServiceServer.Save(ctx, req, rsp)
|
return h.ConfigServiceServer.Save(ctx, req, rsp)
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterConfigServiceServer(s server.Server, sh ConfigServiceServer, opts ...server.HandlerOption) error {
|
func RegisterConfigServiceServer(s server.Server, sh proto.ConfigServiceServer, opts ...options.Option) error {
|
||||||
type configService interface {
|
type configService interface {
|
||||||
Load(ctx context.Context, req *proto.LoadRequest, rsp *proto.LoadResponse) error
|
Load(ctx context.Context, req *proto.LoadRequest, rsp *proto.LoadResponse) error
|
||||||
Save(ctx context.Context, req *proto.SaveRequest, rsp *proto.SaveResponse) error
|
Save(ctx context.Context, req *proto.SaveRequest, rsp *proto.SaveResponse) error
|
||||||
@ -59,6 +60,6 @@ func RegisterConfigServiceServer(s server.Server, sh ConfigServiceServer, opts .
|
|||||||
configService
|
configService
|
||||||
}
|
}
|
||||||
h := &configServiceServer{sh}
|
h := &configServiceServer{sh}
|
||||||
var nopts []server.HandlerOption
|
var nopts []options.Option
|
||||||
return s.Handle(s.NewHandler(&ConfigService{h}, append(nopts, opts...)...))
|
return s.Handle(&ConfigService{h}, append(nopts, opts...)...)
|
||||||
}
|
}
|
||||||
|
10
options.go
10
options.go
@ -2,19 +2,19 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"go.unistack.org/micro/v4/client"
|
"go.unistack.org/micro/v4/client"
|
||||||
"go.unistack.org/micro/v4/config"
|
"go.unistack.org/micro/v4/options"
|
||||||
)
|
)
|
||||||
|
|
||||||
type clientKey struct{}
|
type clientKey struct{}
|
||||||
|
|
||||||
// Client to call config service
|
// Client to call config service
|
||||||
func Client(c client.Client) config.Option {
|
func Client(c client.Client) options.Option {
|
||||||
return config.SetOption(clientKey{}, c)
|
return options.ContextOption(clientKey{}, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
type serviceKey struct{}
|
type serviceKey struct{}
|
||||||
|
|
||||||
// Service to which data load
|
// Service to which data load
|
||||||
func Service(s string) config.Option {
|
func Service(s string) options.Option {
|
||||||
return config.SetOption(serviceKey{}, s)
|
return options.ContextOption(serviceKey{}, s)
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.26.0
|
// protoc-gen-go v1.26.0
|
||||||
// protoc v3.21.12
|
// protoc v4.23.4
|
||||||
// source: service.proto
|
// source: service.proto
|
||||||
|
|
||||||
package servicepb
|
package servicepb
|
||||||
|
27
proto/service_micro.pb.go
Normal file
27
proto/service_micro.pb.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// - protoc-gen-go-micro v4.0.2
|
||||||
|
// - protoc v4.23.4
|
||||||
|
// source: service.proto
|
||||||
|
|
||||||
|
package servicepb
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
_ "go.unistack.org/micro/v4/client"
|
||||||
|
options "go.unistack.org/micro/v4/options"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
ConfigServiceName = "ConfigService"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ConfigServiceClient interface {
|
||||||
|
Load(ctx context.Context, req *LoadRequest, opts ...options.Option) (*LoadResponse, error)
|
||||||
|
Save(ctx context.Context, req *SaveRequest, opts ...options.Option) (*SaveResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ConfigServiceServer interface {
|
||||||
|
Load(ctx context.Context, req *LoadRequest, rsp *LoadResponse) error
|
||||||
|
Save(ctx context.Context, req *SaveRequest, rsp *SaveResponse) error
|
||||||
|
}
|
15
service.go
15
service.go
@ -9,6 +9,7 @@ import (
|
|||||||
pb "go.unistack.org/micro-config-service/v4/proto"
|
pb "go.unistack.org/micro-config-service/v4/proto"
|
||||||
"go.unistack.org/micro/v4/client"
|
"go.unistack.org/micro/v4/client"
|
||||||
"go.unistack.org/micro/v4/config"
|
"go.unistack.org/micro/v4/config"
|
||||||
|
"go.unistack.org/micro/v4/options"
|
||||||
rutil "go.unistack.org/micro/v4/util/reflect"
|
rutil "go.unistack.org/micro/v4/util/reflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -19,14 +20,14 @@ var DefaultStructTag = "service"
|
|||||||
type serviceConfig struct {
|
type serviceConfig struct {
|
||||||
opts config.Options
|
opts config.Options
|
||||||
service string
|
service string
|
||||||
client pbmicro.ConfigClient
|
client pb.ConfigServiceClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *serviceConfig) Options() config.Options {
|
func (c *serviceConfig) Options() config.Options {
|
||||||
return c.opts
|
return c.opts
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *serviceConfig) Init(opts ...config.Option) error {
|
func (c *serviceConfig) Init(opts ...options.Option) error {
|
||||||
if err := config.DefaultBeforeInit(c.opts.Context, c); err != nil && !c.opts.AllowFail {
|
if err := config.DefaultBeforeInit(c.opts.Context, c); err != nil && !c.opts.AllowFail {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -71,7 +72,7 @@ func (c *serviceConfig) Init(opts ...config.Option) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
c.client = pbmicro.NewConfigClient(c.service, cli)
|
c.client = pbmicro.NewConfigServiceClient(c.service, cli)
|
||||||
|
|
||||||
if err := config.DefaultAfterInit(c.opts.Context, c); err != nil && !c.opts.AllowFail {
|
if err := config.DefaultAfterInit(c.opts.Context, c); err != nil && !c.opts.AllowFail {
|
||||||
return err
|
return err
|
||||||
@ -80,7 +81,7 @@ func (c *serviceConfig) Init(opts ...config.Option) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *serviceConfig) Load(ctx context.Context, opts ...config.LoadOption) error {
|
func (c *serviceConfig) Load(ctx context.Context, opts ...options.Option) error {
|
||||||
if err := config.DefaultBeforeLoad(ctx, c); err != nil && !c.opts.AllowFail {
|
if err := config.DefaultBeforeLoad(ctx, c); err != nil && !c.opts.AllowFail {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -131,7 +132,7 @@ func (c *serviceConfig) Load(ctx context.Context, opts ...config.LoadOption) err
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *serviceConfig) Save(ctx context.Context, opts ...config.SaveOption) error {
|
func (c *serviceConfig) Save(ctx context.Context, opts ...options.Option) error {
|
||||||
if err := config.DefaultBeforeSave(ctx, c); err != nil && !c.opts.AllowFail {
|
if err := config.DefaultBeforeSave(ctx, c); err != nil && !c.opts.AllowFail {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -166,11 +167,11 @@ func (c *serviceConfig) Name() string {
|
|||||||
return c.opts.Name
|
return c.opts.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *serviceConfig) Watch(ctx context.Context, opts ...config.WatchOption) (config.Watcher, error) {
|
func (c *serviceConfig) Watch(ctx context.Context, opts ...options.Option) (config.Watcher, error) {
|
||||||
return nil, fmt.Errorf("not implemented")
|
return nil, fmt.Errorf("not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConfig(opts ...config.Option) *serviceConfig {
|
func NewConfig(opts ...options.Option) *serviceConfig {
|
||||||
options := config.NewOptions(opts...)
|
options := config.NewOptions(opts...)
|
||||||
if len(options.StructTag) == 0 {
|
if len(options.StructTag) == 0 {
|
||||||
options.StructTag = DefaultStructTag
|
options.StructTag = DefaultStructTag
|
||||||
|
Loading…
x
Reference in New Issue
Block a user