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" | |
| "math" | |
| "strings" | |
| "testing" | |
| "github.com/pangpanglabs/goutils/test" | |
| ) |
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 TestTimeout(t *testing.T) { | |
| ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*50) | |
| defer cancel() | |
| var wg sync.WaitGroup | |
| for i := 0; i < 10; i++ { | |
| wg.Add(1) | |
| go func(i int) { |
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 TestCalcelation(t *testing.T) { | |
| ctx, cancel := context.WithCancel(context.Background()) | |
| defer cancel() | |
| var wg sync.WaitGroup | |
| for i := 0; i < 10; i++ { | |
| wg.Add(1) | |
| go func(i int) { | |
| defer wg.Done() |
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 (j *Job) Run(in <-chan *sarama.ConsumerMessage) <-chan *sarama.ConsumerMessage { | |
| out := make(chan *sarama.ConsumerMessage) | |
| for msg := range in { | |
| wg := sync.WaitGroup{} | |
| for _, eh := range j.eventHandlers { | |
| wg.Add(1) | |
| go func(eh *eventbroker.EventHandler) { | |
| defer wg.Done() | |
| /************ |
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 CallkerHook struct { | |
| } | |
| func (c *CallkerHook) Levels() []logrus.Level { | |
| return []logrus.Level{ | |
| logrus.DebugLevel, | |
| logrus.InfoLevel, | |
| logrus.WarnLevel, | |
| logrus.ErrorLevel, | |
| } |
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
| using Dapper; | |
| using Nancy; | |
| using Nancy.IO; | |
| using Nancy.ModelBinding; | |
| using Nancy.Json; | |
| using MySql.Data.MySqlClient; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Data.SqlClient; |
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" | |
| "reflect" | |
| ) | |
| type Command struct { | |
| Func interface{} | |
| Args []interface{} |