diff --git a/example/countvowels/std_main.go b/example/countvowels/std_main.go index c3ffd47..24c37c2 100644 --- a/example/countvowels/std_main.go +++ b/example/countvowels/std_main.go @@ -32,7 +32,7 @@ type CountVowelsOuptut struct { //export count_vowels_typed func count_vowels_typed() int32 { var input CountVowelsInput - if err := pdk.InputJson(&input); err != nil { + if err := pdk.InputJSON(&input); err != nil { pdk.SetError(err) return -1 } @@ -44,7 +44,7 @@ func count_vowels_typed() int32 { //export count_vowels_json_output func count_vowels_json_output() int32 { output := CountVowelsOuptut{Count: 42, Total: 2.1e7, Vowels: "aAeEiIoOuUyY"} - err := pdk.OutputJson(output) + err := pdk.OutputJSON(output) if err != nil { pdk.SetError(err) return -1 diff --git a/example/countvowels/tiny_main.go b/example/countvowels/tiny_main.go index cd47dbd..fd45ba6 100644 --- a/example/countvowels/tiny_main.go +++ b/example/countvowels/tiny_main.go @@ -22,7 +22,7 @@ type CountVowelsOuptut struct { //export count_vowels_typed func count_vowels_typed() int32 { var input CountVowelsInput - if err := pdk.InputJson(&input); err != nil { + if err := pdk.InputJSON(&input); err != nil { pdk.SetError(err) return -1 } @@ -34,7 +34,7 @@ func count_vowels_typed() int32 { //export count_vowels_json_output func count_vowels_json_output() int32 { output := CountVowelsOuptut{Count: 42, Total: 2.1e7, Vowels: "aAeEiIoOuUyY"} - err := pdk.OutputJson(output) + err := pdk.OutputJSON(output) if err != nil { pdk.SetError(err) return -1 diff --git a/extism_pdk.go b/extism_pdk.go index 58e0172..7ff8794 100644 --- a/extism_pdk.go +++ b/extism_pdk.go @@ -77,16 +77,16 @@ func Input() []byte { return loadInput() } -func JsonFrom(offset uint64, v any) error { +func JSONFrom(offset uint64, v any) error { mem := FindMemory(offset) return json.Unmarshal(mem.ReadBytes(), v) } -func InputJson(v any) error { +func InputJSON(v any) error { return json.Unmarshal(Input(), v) } -func OutputJson(v any) error { +func OutputJSON(v any) error { b, err := json.Marshal(v) if err != nil { return err