-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
219 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package json | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/antlabs/tostruct/option" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestEmpty(t *testing.T) { | ||
str := []byte("") | ||
all, err := Marshal(str, option.WithStructName("empty"), option.WithTagName("json")) | ||
assert.Error(t, err) | ||
assert.Equal(t, all, []byte(nil)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
type reqName struct { | ||
Action string `json:"action"` | ||
Count int `json:"count"` | ||
Data map[string]string `json:"data"` | ||
Duration int `json:"duration"` | ||
entities interface{} `json:"json:entities"` | ||
Timestamp int `json:"timestamp"` | ||
URI string `json:"uri"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
type reqName struct { | ||
Action string `json:"action"` | ||
Count int `json:"count"` | ||
Data struct { | ||
Data map[string]string `json:"data"` | ||
} `json:"data"` | ||
Duration int `json:"duration"` | ||
entities interface{} `json:"json:entities"` | ||
Timestamp int `json:"timestamp"` | ||
URI string `json:"uri"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
type reqName struct { | ||
Action string `json:"action"` | ||
Count int `json:"count"` | ||
Data Data `json:"data"` | ||
Duration int `json:"duration"` | ||
entities interface{} `json:"json:entities"` | ||
Timestamp int `json:"timestamp"` | ||
URI string `json:"uri"` | ||
} | ||
|
||
type Data struct { | ||
Data map[string]string `json:"data"` | ||
} |