add testable json marshaller (#161)

This commit is contained in:
sashabaranov
2023-03-15 12:16:47 +04:00
committed by GitHub
parent ba77a6476e
commit 53d195cf5a
10 changed files with 102 additions and 18 deletions

15
marshaller.go Normal file
View File

@@ -0,0 +1,15 @@
package openai
import (
"encoding/json"
)
type marshaller interface {
marshal(value any) ([]byte, error)
}
type jsonMarshaller struct{}
func (jm *jsonMarshaller) marshal(value any) ([]byte, error) {
return json.Marshal(value)
}