Skip to content

Commit

Permalink
go mod v2
Browse files Browse the repository at this point in the history
  • Loading branch information
seefan committed Mar 31, 2021
1 parent 77b85df commit d61848f
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}",
"program":"${workspaceFolder}/test/test.go",
"env": {},
"args": []
}
Expand Down
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"fmt"
"strconv"

"github.com/seefan/gossdb/ssdbclient"
"github.com/seefan/gossdb/v2/ssdbclient"
)

const (
Expand Down
5 changes: 3 additions & 2 deletions client/close.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package client

//Close 可关闭接口
type Close interface{
type Close interface {
//CloseBack close func
CloseBack()
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/seefan/gossdb
module github.com/seefan/gossdb/v2

go 1.14

Expand Down
4 changes: 2 additions & 2 deletions gossdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package gossdb
import (
"errors"

"github.com/seefan/gossdb/conf"
"github.com/seefan/gossdb/pool"
"github.com/seefan/gossdb/v2/conf"
"github.com/seefan/gossdb/v2/pool"
)

var (
Expand Down
10 changes: 5 additions & 5 deletions pool/connectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"sync/atomic"
"time"

"github.com/seefan/gossdb/client"
"github.com/seefan/gossdb/conf"
"github.com/seefan/gossdb/consts"
"github.com/seefan/gossdb/ssdbclient"
"github.com/seefan/gossdb/v2/client"
"github.com/seefan/gossdb/v2/conf"
"github.com/seefan/gossdb/v2/consts"
"github.com/seefan/gossdb/v2/ssdbclient"
)

//Connectors connection pool
Expand Down Expand Up @@ -171,7 +171,7 @@ func (c *Connectors) appendPool() (err error) {
p.index = pos
atomic.AddInt32(&c.cellPos, 1)
}
println("append pool", pos+1)
//println("append pool", pos+1)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion pool/connectors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"sync"
"testing"

"github.com/seefan/gossdb/conf"
"github.com/seefan/gossdb/v2/conf"
)

func BenchmarkConnectors_NewClient10(b *testing.B) {
Expand Down
4 changes: 2 additions & 2 deletions pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package pool
import (
"sync"

"github.com/seefan/gossdb/consts"
"github.com/seefan/gossdb/queue"
"github.com/seefan/gossdb/v2/consts"
"github.com/seefan/gossdb/v2/queue"
)

//Pool pool block
Expand Down
2 changes: 1 addition & 1 deletion pool/pool_client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package pool

import (
"github.com/seefan/gossdb/client"
"github.com/seefan/gossdb/v2/client"
)

//Client pooled client
Expand Down
2 changes: 1 addition & 1 deletion ssdbclient/ssdb_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"time"

"github.com/seefan/goerr"
"github.com/seefan/gossdb/conf"
"github.com/seefan/gossdb/v2/conf"
)

const (
Expand Down
14 changes: 7 additions & 7 deletions ssdbclient/ssdb_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/seefan/gossdb/conf"
"github.com/seefan/gossdb/v2/conf"
)

func TestSSDBClient_ping(t *testing.T) {
Expand Down Expand Up @@ -244,11 +244,11 @@ func TestSSDBClient_getBig(t *testing.T) {
// t.Error(err)
//}
//for i := 0; i < 1000; i++ {
if v, err := c.Do("hget", "app:0","1359003378"); err == nil {
t.Log(len(v[1]))
} else {
t.Error(err)
}
if v, err := c.Do("hget", "app:0", "1359003378"); err == nil {
t.Log(len(v[1]))
} else {
t.Error(err)
}
//}
if err := c.Close(); err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -287,7 +287,7 @@ func TestSSDBClient_multiget(t *testing.T) {
t.Fatal(err)
}
defer c.Close()
if v, err := c.Do("multi_hget", "black:0", "0:0:1000565011","0:0:1001394200"); err == nil {
if v, err := c.Do("multi_hget", "black:0", "0:0:1000565011", "0:0:1001394200"); err == nil {
t.Log(v)
} else {
t.Error(err)
Expand Down
25 changes: 12 additions & 13 deletions test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
package main

import (
"log"
"math"
_ "net/http/pprof"
"sync"
"time"

"github.com/seefan/gossdb"
"github.com/seefan/gossdb/conf"
"github.com/seefan/gossdb/v2"
"github.com/seefan/gossdb/v2/conf"
)

func main() {
Expand All @@ -24,10 +23,10 @@ func main() {
MaxWaitSize: 10000,
PoolSize: 5,
MinPoolSize: 5,
MaxPoolSize: 50,
MaxPoolSize: 10,
AutoClose: true,
//Password: "vdsfsfafapaddssrd#@Ddfasfdsfedssdfsdfsd",
HealthSecond: 5,
HealthSecond: 10,
})
if err != nil {
panic(err)
Expand All @@ -41,20 +40,20 @@ func main() {
// }()

var wait sync.WaitGroup
for i := 0; i < 100; i++ {
for i := 0; i < 7; i++ {
wait.Add(1)
go func() {
for k := 0; k < 100; k++ {

for j := 0; j < 100; j++ {
e := p.GetClient().Set("big", "ddddd")
if e == nil {
if _, e := p.GetClient().Get("big"); err != nil {
log.Println(e)
}
c, e := p.NewClient()

if e != nil {
println(e.Error())
} else {
time.Sleep(time.Millisecond * time.Duration(math.Round(10)))
c.Close()
}
}
time.Sleep(time.Millisecond * time.Duration(math.Round(100)))
//println(p.Info())
}
wait.Done()
Expand Down

0 comments on commit d61848f

Please sign in to comment.