(arr zapcore.ArrayEncoder)
| 178 | type objectValues[T any, P ObjectMarshalerPtr[T]] []T |
| 179 | |
| 180 | func (os objectValues[T, P]) MarshalLogArray(arr zapcore.ArrayEncoder) error { |
| 181 | for i := range os { |
| 182 | // It is necessary for us to explicitly reference the "P" type. |
| 183 | // We cannot simply pass "&os[i]" to AppendObject because its type |
| 184 | // is "*T", which the type system does not consider as |
| 185 | // implementing ObjectMarshaler. |
| 186 | // Only the type "P" satisfies ObjectMarshaler, which we have |
| 187 | // to convert "*T" to explicitly. |
| 188 | var p P = &os[i] |
| 189 | if err := arr.AppendObject(p); err != nil { |
| 190 | return err |
| 191 | } |
| 192 | } |
| 193 | return nil |
| 194 | } |
| 195 | |
| 196 | // Strings constructs a field that carries a slice of strings. |
| 197 | func Strings(key string, ss []string) Field { |
nothing calls this directly
no test coverage detected