Skip to content

Commit

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

// 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 = 0

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 = 1

type frozenConfig struct {
Config
encoderOpts encoder.Options
Expand Down

0 comments on commit 99a6e2e

Please sign in to comment.