Skip to content

[Fixes 89] Add Delete and DeleteBytes with Options. #90

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
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
10 changes: 10 additions & 0 deletions sjson.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,11 +487,21 @@ func Delete(json, path string) (string, error) {
return Set(json, path, dtype{})
}

// DeleteOptions deletes a value from json for the specified path, with the given options.
func DeleteOptions(json, path string, options *Options) (string, error) {
return SetOptions(json, path, dtype{}, options)
}

// DeleteBytes deletes a value from json for the specified path.
func DeleteBytes(json []byte, path string) ([]byte, error) {
return SetBytes(json, path, dtype{})
}

// DeleteBytesOptions deletes a value from json for the specified path, with the given options.
func DeleteBytesOptions(json []byte, path string, options *Options) ([]byte, error) {
return SetBytesOptions(json, path, dtype{}, options)
}

type stringHeader struct {
data unsafe.Pointer
len int
Expand Down