Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add APIKind to indicate std-json or sonic #673

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
liuq19 marked this conversation as resolved.
Show resolved Hide resolved

// 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
Loading