Proposal for Custom JSON Encoder/Decoder
- Langage dominant
- Go
- Étoiles
- 10.8k
- Forks
- 1.3k
- Merge moyen
- 2 j 36 min
- PR mergées (30 j)
- 26
Description
### Description
I am proposing the addition of a custom JSON encoder/decoder feature to the gqlgen library. This feature aims to provide an alternative for users who are not satisfied with the standard encoding/json library in gqlgen. The implementation of this feature would allow users to have a faster alternative for encoding and decoding JSON data, specifically during request processing.
### Rationale
The primary motivation behind introducing this custom JSON encoder/decoder is to enhance the performance and flexibility of gqlgen for users who require improved JSON encoding and decoding capabilities. By offering the option to replace the default encoding/json library, users can achieve better performance and tailored JSON processing for their specific use cases.
It's important to note that this custom JSON encoder/decoder would only be utilized during request processing. The existing usage of encoding/json for internal components within the library would remain unchanged to ensure stability and maintainability.
#### Performance Improvements
Several third-party libraries offer faster JSON encoding and decoding capabilities compared to encoding/json. Some of these libraries include:
- [goccy/go-json](https://github.com/goccy/go-json)
- [bytedance/sonic](https://github.com/bytedance/sonic)
- [segmentio/encoding](https://github.com/segmentio/encoding)
- [mailru/easyjson](https://github.com/mailru/easyjson)
- [minio/simdjson-go](https://github.com/minio/simdjson-go)
- [wI2L/jettison](https://github.com/wI2L/jettison)
By incorporating a customizable JSON encoder/decoder, gqlgen users would have the opportunity to leverage these third-party libraries to achieve significant performance enhancements for their GraphQL operations.
### Implementation
I propose to take the responsibility of implementing this custom JSON encoder/decoder feature myself. This would involve integrating the chosen third-party library, ensuring compatibility with gqlgen's architecture, and providing users with clear documentation on how to enable and use the custom encoder/decoder for their GraphQL operations.
I believe that this addition would greatly contribute to the overall flexibility and performance of gqlgen, catering to users with diverse needs in JSON processing.
Thank you for considering this proposal. I look forward to discussing the implementation details and potential integration of this feature into the gqlgen library.
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.