коммит произвёл
GitHub
родитель
b45ff0be5d
Коммит
717a4d04a9
@@ -4,11 +4,11 @@
|
||||
package audit
|
||||
|
||||
// Meta represents metadata that can be added to a audit record as name/value pairs.
|
||||
type Meta map[string]interface{}
|
||||
type Meta map[string]any
|
||||
|
||||
// FuncMetaTypeConv defines a function that can convert meta data types into something
|
||||
// that serializes well for audit records.
|
||||
type FuncMetaTypeConv func(val interface{}) (newVal interface{}, converted bool)
|
||||
type FuncMetaTypeConv func(val any) (newVal any, converted bool)
|
||||
|
||||
// Record provides a consistent set of fields used for all audit logging.
|
||||
type Record struct {
|
||||
@@ -34,7 +34,7 @@ func (rec *Record) Fail() {
|
||||
}
|
||||
|
||||
// AddMeta adds a single name/value pair to this audit record's metadata.
|
||||
func (rec *Record) AddMeta(name string, val interface{}) {
|
||||
func (rec *Record) AddMeta(name string, val any) {
|
||||
if rec.Meta == nil {
|
||||
rec.Meta = Meta{}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ type wilted struct {
|
||||
wilt1 string
|
||||
}
|
||||
|
||||
func conv(val interface{}) (interface{}, bool) {
|
||||
func conv(val any) (any, bool) {
|
||||
switch v := val.(type) {
|
||||
case *bloated:
|
||||
return &wilted{wilt1: v.fld1}, true
|
||||
@@ -34,7 +34,7 @@ func TestRecord_AddMeta(t *testing.T) {
|
||||
}
|
||||
type args struct {
|
||||
name string
|
||||
val interface{}
|
||||
val any
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
Ссылка в новой задаче
Block a user