-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: kl7sn <mex7.0828@gmail.com>
- Loading branch information
Showing
46 changed files
with
1,270 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module github.com/gotomicro/cetus/l | ||
|
||
go 1.20 | ||
|
||
require go.uber.org/zap v1.24.0 | ||
|
||
require ( | ||
go.uber.org/atomic v1.7.0 // indirect | ||
go.uber.org/multierr v1.6.0 // indirect | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= | ||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= | ||
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= | ||
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= | ||
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= | ||
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= | ||
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= | ||
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= | ||
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= | ||
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= | ||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package l | ||
|
||
import ( | ||
"go.uber.org/zap" | ||
) | ||
|
||
var ( | ||
I = zap.Int | ||
I64 = zap.Int64 | ||
I32 = zap.Int32 | ||
F64 = zap.Float64 | ||
S = zap.String | ||
B = zap.Bool | ||
E = zap.Error | ||
A = zap.Any | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package x | ||
|
||
import ( | ||
"log" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestS2I64(t *testing.T) { | ||
cases := []struct { | ||
in string | ||
exp int64 | ||
}{ | ||
{"0", 0}, | ||
{"999", 999}, | ||
{"-999", -999}, | ||
} | ||
for _, c := range cases { | ||
res := S2I64(c.in) | ||
log.Printf("%+v\n"+"res--------------->", res) | ||
assert.Equal(t, c.exp, res) | ||
} | ||
} | ||
|
||
func TestI2S(t *testing.T) { | ||
type cs[T Int] struct { | ||
in T | ||
exp string | ||
} | ||
c1 := cs[int]{0, "0"} | ||
res := I2S(c1.in) | ||
log.Printf("res--------------->"+"%+v\n", res) | ||
assert.Equal(t, c1.exp, res) | ||
|
||
c2 := cs[int8]{9, "9"} | ||
res = I2S(c2.in) | ||
log.Printf("res--------------->"+"%+v\n", res) | ||
assert.Equal(t, c2.exp, res) | ||
|
||
c3 := cs[int32]{999, "999"} | ||
res = I2S(c3.in) | ||
log.Printf("res--------------->"+"%+v\n", res) | ||
assert.Equal(t, c3.exp, res) | ||
|
||
type MyI32 int32 | ||
c4 := cs[MyI32]{999, "999"} | ||
res = I2S(c4.in) | ||
log.Printf("res--------------->"+"%+v\n", res) | ||
assert.Equal(t, c4.exp, res) | ||
|
||
c5 := cs[int16]{9999, "9999"} | ||
res = I2S(c5.in) | ||
log.Printf("res--------------->"+"%+v\n", res) | ||
assert.Equal(t, c5.exp, res) | ||
} | ||
|
||
func TestUI2S(t *testing.T) { | ||
type cs[T Uint] struct { | ||
in T | ||
exp string | ||
} | ||
c1 := cs[uint8]{0, "0"} | ||
res := UI2S(c1.in) | ||
log.Printf("res--------------->"+"%+v\n", res) | ||
assert.Equal(t, c1.exp, res) | ||
|
||
c2 := cs[uint32]{9, "9"} | ||
res = UI2S(c2.in) | ||
log.Printf("res--------------->"+"%+v\n", res) | ||
assert.Equal(t, c2.exp, res) | ||
|
||
c3 := cs[uint64]{999, "999"} | ||
res = UI2S(c3.in) | ||
log.Printf("res--------------->"+"%+v\n", res) | ||
assert.Equal(t, c3.exp, res) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package kutils | ||
package x | ||
|
||
import ( | ||
"fmt" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module github.com/gotomicro/cetus/x | ||
|
||
go 1.20 | ||
|
||
require ( | ||
github.com/gotomicro/ego v1.1.12 | ||
github.com/stretchr/testify v1.8.4 | ||
go.uber.org/zap v1.24.0 | ||
) | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/go-logr/logr v1.2.3 // indirect | ||
github.com/go-logr/stdr v1.2.2 // indirect | ||
github.com/gotomicro/logrotate v0.0.0-20211108034117-46d53eedc960 // indirect | ||
github.com/mitchellh/mapstructure v1.5.0 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
github.com/spf13/cast v1.4.1 // indirect | ||
go.opentelemetry.io/otel v1.7.0 // indirect | ||
go.opentelemetry.io/otel/trace v1.7.0 // indirect | ||
go.uber.org/atomic v1.7.0 // indirect | ||
go.uber.org/multierr v1.6.0 // indirect | ||
google.golang.org/grpc v1.46.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
Oops, something went wrong.