Skip to content

Commit a65337d

Browse files
committed
chore: update examples to v0.2.0
1 parent 3e08f18 commit a65337d

File tree

24 files changed

+137
-386
lines changed

24 files changed

+137
-386
lines changed

benchmarks/event/cmd/handler/wire.go

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,17 @@ package main
66
import (
77
"context"
88
"fmt"
9-
"net/url"
109
"os"
1110
"os/signal"
1211
"syscall"
1312

14-
"github.com/go-orb/go-orb/config"
1513
"github.com/go-orb/go-orb/event"
1614
"github.com/go-orb/go-orb/log"
1715
"github.com/go-orb/go-orb/types"
16+
"github.com/go-orb/plugins/config/source/cli/urfave"
1817
"github.com/go-orb/wire"
1918
)
2019

21-
// provideConfigData reads the config from cli and returns it.
22-
func provideConfigData(
23-
serviceName types.ServiceName,
24-
serviceVersion types.ServiceVersion,
25-
) (types.ConfigData, error) {
26-
u, err := url.Parse("cli://urfave")
27-
if err != nil {
28-
return nil, err
29-
}
30-
31-
cfgSections := types.SplitServiceName(serviceName)
32-
33-
data, err := config.Read([]*url.URL{u}, cfgSections)
34-
35-
return data, err
36-
}
37-
3820
// wireRunResult is here so "wire" has a type for the return value of wireRun.
3921
// wire needs a explicit type for each provider including "wireRun".
4022
type wireRunResult string
@@ -91,7 +73,7 @@ func run(
9173
cb wireRunCallback,
9274
) (wireRunResult, error) {
9375
panic(wire.Build(
94-
provideConfigData,
76+
urfave.ProvideConfigData,
9577
wire.Value([]log.Option{}),
9678
log.Provide,
9779
wire.Value([]event.Option{}),

benchmarks/event/cmd/handler/wire_gen.go

Lines changed: 2 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benchmarks/event/cmd/request/wire.go

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,17 @@ package main
66
import (
77
"context"
88
"fmt"
9-
"net/url"
109
"os"
1110
"os/signal"
1211
"syscall"
1312

14-
"github.com/go-orb/go-orb/config"
1513
"github.com/go-orb/go-orb/event"
1614
"github.com/go-orb/go-orb/log"
1715
"github.com/go-orb/go-orb/types"
16+
"github.com/go-orb/plugins/config/source/cli/urfave"
1817
"github.com/go-orb/wire"
1918
)
2019

21-
// provideConfigData reads the config from cli and returns it.
22-
func provideConfigData(
23-
serviceName types.ServiceName,
24-
serviceVersion types.ServiceVersion,
25-
) (types.ConfigData, error) {
26-
u, err := url.Parse("cli://urfave")
27-
if err != nil {
28-
return nil, err
29-
}
30-
31-
cfgSections := types.SplitServiceName(serviceName)
32-
33-
data, err := config.Read([]*url.URL{u}, cfgSections)
34-
35-
return data, err
36-
}
37-
3820
// wireRunResult is here so "wire" has a type for the return value of wireRun.
3921
type wireRunResult string
4022

@@ -90,7 +72,7 @@ func run(
9072
cb wireRunCallback,
9173
) (wireRunResult, error) {
9274
panic(wire.Build(
93-
provideConfigData,
75+
urfave.ProvideConfigData,
9476
wire.Value([]log.Option{}),
9577
log.Provide,
9678
wire.Value([]event.Option{}),

benchmarks/event/cmd/request/wire_gen.go

Lines changed: 2 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benchmarks/rps/cmd/orb-rps-client/wire.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/go-orb/go-orb/log"
1818
"github.com/go-orb/go-orb/registry"
1919
"github.com/go-orb/go-orb/types"
20+
"github.com/go-orb/plugins/config/source/cli/urfave"
2021

2122
"github.com/go-orb/wire"
2223
)
@@ -90,7 +91,7 @@ func run(
9091
cb wireRunCallback,
9192
) (wireRunResult, error) {
9293
panic(wire.Build(
93-
provideConfigData,
94+
urfave.ProvideConfigData,
9495
wire.Value([]log.Option{}),
9596
log.Provide,
9697
wire.Value([]registry.Option{}),

benchmarks/rps/cmd/orb-rps-client/wire_gen.go

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benchmarks/rps/cmd/orb-rps-server/wire.go

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,25 @@ package main
77
import (
88
"context"
99
"fmt"
10-
"net/url"
1110
"os"
1211
"os/signal"
1312
"syscall"
1413

15-
"github.com/go-orb/go-orb/config"
1614
"github.com/go-orb/go-orb/log"
1715
"github.com/go-orb/go-orb/registry"
1816
"github.com/go-orb/go-orb/server"
1917
"github.com/go-orb/go-orb/types"
2018

2119
"github.com/go-orb/examples/benchmarks/rps/handler/echo"
2220
proto "github.com/go-orb/examples/benchmarks/rps/proto/echo"
21+
"github.com/go-orb/plugins/config/source/cli/urfave"
2322
"github.com/go-orb/plugins/server/drpc"
2423
mgrpc "github.com/go-orb/plugins/server/grpc"
2524
mhttp "github.com/go-orb/plugins/server/http"
2625

2726
"github.com/go-orb/wire"
2827
)
2928

30-
// provideConfigData reads the config from cli and returns it.
31-
func provideConfigData(
32-
serviceName types.ServiceName,
33-
serviceVersion types.ServiceVersion,
34-
) (types.ConfigData, error) {
35-
u, err := url.Parse("cli://urfave")
36-
if err != nil {
37-
return nil, err
38-
}
39-
40-
cfgSections := types.SplitServiceName(serviceName)
41-
42-
data, err := config.Read([]*url.URL{u}, cfgSections)
43-
44-
return data, err
45-
}
46-
4729
// provideServerOpts provides options for the go-orb server.
4830
func provideServerOpts() ([]server.ConfigOption, error) {
4931

@@ -144,7 +126,7 @@ func run(
144126
cb wireRunCallback,
145127
) (wireRunResult, error) {
146128
panic(wire.Build(
147-
provideConfigData,
129+
urfave.ProvideConfigData,
148130
wire.Value([]log.Option{}),
149131
log.Provide,
150132
wire.Value([]registry.Option{}),

benchmarks/rps/cmd/orb-rps-server/wire_gen.go

Lines changed: 2 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

event/simple/cmd/handler/wire.go

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,17 @@ package main
66
import (
77
"context"
88
"fmt"
9-
"net/url"
109
"os"
1110
"os/signal"
1211
"syscall"
1312

14-
"github.com/go-orb/go-orb/config"
1513
"github.com/go-orb/go-orb/event"
1614
"github.com/go-orb/go-orb/log"
1715
"github.com/go-orb/go-orb/types"
16+
"github.com/go-orb/plugins/config/source/cli/urfave"
1817
"github.com/go-orb/wire"
1918
)
2019

21-
// provideConfigData reads the config from cli and returns it.
22-
func provideConfigData(
23-
serviceName types.ServiceName,
24-
serviceVersion types.ServiceVersion,
25-
) (types.ConfigData, error) {
26-
u, err := url.Parse("cli://urfave")
27-
if err != nil {
28-
return nil, err
29-
}
30-
31-
cfgSections := types.SplitServiceName(serviceName)
32-
33-
data, err := config.Read([]*url.URL{u}, cfgSections)
34-
35-
return data, err
36-
}
37-
3820
type wireRunResult string
3921

4022
type wireRunCallback func(
@@ -83,7 +65,7 @@ func run(
8365
cb wireRunCallback,
8466
) (wireRunResult, error) {
8567
panic(wire.Build(
86-
provideConfigData,
68+
urfave.ProvideConfigData,
8769
wire.Value([]log.Option{}),
8870
log.Provide,
8971
wire.Value([]event.Option{}),

0 commit comments

Comments
 (0)