Skip to content

Commit

Permalink
feat: add APIKind to indicate std-json or sonic (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
lvan100 authored Jul 19, 2024
1 parent 65b7fbe commit 15dff36
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ import (
`github.com/bytedance/sonic/internal/rt`
)

const (
UseStdJSON = iota
UseSonicJSON
)

// APIKind is the kind of API, 0 is std json, 1 is sonic.
const APIKind = apiKind

// Config is a combination of sonic/encoder.Options and sonic/decoder.Options
type Config struct {
// EscapeHTML indicates encoder to escape all HTML characters
Expand Down
2 changes: 2 additions & 0 deletions compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import (
`github.com/bytedance/sonic/option`
)

const apiKind = UseStdJSON

type frozenConfig struct {
Config
}
Expand Down
2 changes: 2 additions & 0 deletions sonic.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import (
`github.com/bytedance/sonic/internal/rt`
)

const apiKind = UseSonicJSON

type frozenConfig struct {
Config
encoderOpts encoder.Options
Expand Down

0 comments on commit 15dff36

Please sign in to comment.