This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type Customer struct { | |
Name string | |
} | |
func main() { | |
customers := []*Customer{{Name: "Oss"}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Process(name *sync.String) { | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Process(cfg *config) { | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cfg := config{} | |
ii := []consul.Item{consul.NewKeyItem("harvester/example_03/balance")} | |
h, err := harvester.New(&cfg). | |
WithConsulSeed("127.0.0.1:8500", "", "", 0). | |
WithConsulMonitor("127.0.0.1:8500", "", "", 0, ii...). | |
Create() | |
if err != nil { | |
log.Fatalf("failed to create harvester: %v", err) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cfg := config{} | |
h, err := harvester.New(&cfg). | |
WithConsulSeed("127.0.0.1:8500", "", "", 0). | |
Create() | |
if err != nil { | |
log.Fatalf("failed to create harvester: %v", err) | |
} | |
err = h.Harvest(ctx) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cfg := config{} | |
h, err := harvester.New(&cfg).Create() | |
if err != nil { | |
log.Fatalf("failed to create harvester: %v", err) | |
} | |
err = h.Harvest(ctx) | |
if err != nil { | |
log.Fatalf("failed to harvest configuration: %v", err) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Config struct { | |
Name sync.String `seed:"John Doe"` | |
Age sync.Int64 `seed:"18" env:"ENV_AGE"` | |
IsAdmin sync.Bool `seed:"true" env:"ENV_IS_ADMIN" consul:"/config/is-admin"` | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
"os/signal" | |
"syscall" | |
"github.com/confluentinc/confluent-kafka-go/kafka" | |
beatkafka "github.com/taxibeat/go-toolkit/benchmarks/kafka" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<int> ProcessMessagesAsync(List<string> messages, IProgress<int> progress) | |
{ | |
int totalCount = messages.Count; | |
int processCount = await Task.Run<int>(() => | |
{ | |
int tempCount = 0; | |
foreach (var message in messages) | |
{ | |
Console.WriteLine(message); | |
if (progress != null) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public bool Run() | |
{ | |
return true; | |
} | |
public Task<bool> RunAsync() | |
{ | |
return Task.FromResult(true); | |
} |
NewerOlder