Skip to content

Commit 303c967

Browse files
authored
feat: Nested value helpers (#99)
Signed-off-by: Anush008 <[email protected]>
1 parent a5a5d2b commit 303c967

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

qdrant/value_map.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,25 @@ func NewValueStruct(v *Struct) *Value {
142142
return &Value{Kind: &Value_StructValue{StructValue: v}}
143143
}
144144

145+
// Constructs a new struct Value from the provided field map.
146+
func NewValueFromFields(fields map[string]*Value) *Value {
147+
return &Value{Kind: &Value_StructValue{StructValue: &Struct{
148+
Fields: fields,
149+
}}}
150+
}
151+
145152
// Constructs a new list Value.
146153
func NewValueList(v *ListValue) *Value {
147154
return &Value{Kind: &Value_ListValue{ListValue: v}}
148155
}
149156

157+
// Constructs a new list Value from the provided elements.
158+
func NewValueFromList(values ...*Value) *Value {
159+
return &Value{Kind: &Value_ListValue{ListValue: &ListValue{
160+
Values: values,
161+
}}}
162+
}
163+
150164
// Constructs a ListValue from a general-purpose Go slice.
151165
// The slice elements are converted using NewValue().
152166
func NewListValue(v []interface{}) (*ListValue, error) {

0 commit comments

Comments
 (0)