Add format config support

This commit is contained in:
世界
2022-07-03 03:42:57 +08:00
parent 30444057bd
commit 85a695caa1
10 changed files with 77 additions and 60 deletions

View File

@@ -4,8 +4,8 @@ import "encoding/json"
type Listable[T comparable] []T
func (l *Listable[T]) MarshalJSON() ([]byte, error) {
arrayList := []T(*l)
func (l Listable[T]) MarshalJSON() ([]byte, error) {
arrayList := []T(l)
if len(arrayList) == 1 {
return json.Marshal(arrayList[0])
}