MCPcopy
hub / github.com/openai/openai-go / arrayInterface

Method arrayInterface

internal/encoding/json/decode.go:1062–1085  ·  view source on GitHub ↗

arrayInterface is like array but returns []any.

()

Source from the content-addressed store, hash-verified

1060
1061// arrayInterface is like array but returns []any.
1062func (d *decodeState) arrayInterface() []any {
1063 var v = make([]any, 0)
1064 for {
1065 // Look ahead for ] - can only happen on first iteration.
1066 d.scanWhile(scanSkipSpace)
1067 if d.opcode == scanEndArray {
1068 break
1069 }
1070
1071 v = append(v, d.valueInterface())
1072
1073 // Next token must be , or ].
1074 if d.opcode == scanSkipSpace {
1075 d.scanWhile(scanSkipSpace)
1076 }
1077 if d.opcode == scanEndArray {
1078 break
1079 }
1080 if d.opcode != scanArrayValue {
1081 panic(phasePanicMsg)
1082 }
1083 }
1084 return v
1085}
1086
1087// objectInterface is like object but returns map[string]any.
1088func (d *decodeState) objectInterface() map[string]any {

Callers 2

arrayMethod · 0.95
valueInterfaceMethod · 0.95

Calls 2

scanWhileMethod · 0.95
valueInterfaceMethod · 0.95

Tested by

no test coverage detected