Compare commits
7 Commits
vtolstov-p
...
66ccd6021f
| Author | SHA1 | Date | |
|---|---|---|---|
| 66ccd6021f | |||
| e5346f7e4f | |||
|
|
daf19f031a | ||
| 5989fd54ca | |||
| ed30c26324 | |||
| 0f8f93d09a | |||
|
|
f460e2f8dd |
@@ -1,5 +1,5 @@
|
|||||||
# Micro
|
# Micro
|
||||||

|

|
||||||
|
|
||||||
Micro is a standard library for microservices.
|
Micro is a standard library for microservices.
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,16 @@ func (m *Frame) UnmarshalJSON(data []byte) error {
|
|||||||
return m.Unmarshal(data)
|
return m.Unmarshal(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalYAML returns frame data
|
||||||
|
func (m *Frame) MarshalYAML() ([]byte, error) {
|
||||||
|
return m.Marshal()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalYAML set frame data
|
||||||
|
func (m *Frame) UnmarshalYAML(data []byte) error {
|
||||||
|
return m.Unmarshal(data)
|
||||||
|
}
|
||||||
|
|
||||||
// ProtoMessage noop func
|
// ProtoMessage noop func
|
||||||
func (m *Frame) ProtoMessage() {}
|
func (m *Frame) ProtoMessage() {}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
uuidv8 "github.com/ash3in/uuidv8"
|
uuidv8 "github.com/ash3in/uuidv8"
|
||||||
|
"github.com/google/uuid"
|
||||||
nanoid "github.com/matoous/go-nanoid"
|
nanoid "github.com/matoous/go-nanoid"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -96,6 +97,10 @@ func New(opts ...Option) (string, error) {
|
|||||||
return "", errors.New("invalid option, Type unspecified")
|
return "", errors.New("invalid option, Type unspecified")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ToUUID(s string) uuid.UUID {
|
||||||
|
return uuid.MustParse(s)
|
||||||
|
}
|
||||||
|
|
||||||
// Must is the same as New but fatals on error
|
// Must is the same as New but fatals on error
|
||||||
func MustNew(opts ...Option) string {
|
func MustNew(opts ...Option) string {
|
||||||
id, err := New(opts...)
|
id, err := New(opts...)
|
||||||
|
|||||||
@@ -7,5 +7,14 @@ func TestUUIDv8(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
t.Logf("xxx %s\n", id)
|
_ = id
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestToUUID(t *testing.T) {
|
||||||
|
id, err := New()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
u := ToUUID(id)
|
||||||
|
_ = u
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user