Skip to content

Commit

Permalink
FIX. jsoniter.Marshaler undefined.
Browse files Browse the repository at this point in the history
  • Loading branch information
PotatoCloud committed Oct 8, 2024
1 parent 6b156c4 commit ee46bcb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
18 changes: 3 additions & 15 deletions json.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
//go:build jsoniter

package log

import (
jsoniter "github.com/json-iterator/go"
)
import "encoding/json"

type (
Marshaler = jsoniter.Marshaler
RawMessage = jsoniter.RawMessage
Marshaler = json.Marshaler
RawMessage = json.RawMessage
)

func Marshal(v any) ([]byte, error) {
return jsoniter.ConfigFastest.Marshal(v)
}

func MarshalIndent(v any, prefix, indent string) ([]byte, error) {
return jsoniter.ConfigFastest.MarshalIndent(v, prefix, indent)
}
15 changes: 15 additions & 0 deletions json_iter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//go:build jsoniter

package log

import (
jsoniter "github.com/json-iterator/go"
)

func Marshal(v any) ([]byte, error) {
return jsoniter.ConfigFastest.Marshal(v)
}

func MarshalIndent(v any, prefix, indent string) ([]byte, error) {
return jsoniter.ConfigFastest.MarshalIndent(v, prefix, indent)
}
5 changes: 0 additions & 5 deletions json_std.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ package log

import "encoding/json"

type (
Marshaler = json.Marshaler
RawMessage = json.RawMessage
)

func Marshal(v any) ([]byte, error) {
return json.Marshal(v)
}
Expand Down

0 comments on commit ee46bcb

Please sign in to comment.