github.com/weaviate/weaviate@v1.24.6/usecases/objects/batch_helper.go (about) 1 // _ _ 2 // __ _____ __ ___ ___ __ _| |_ ___ 3 // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ 4 // \ V V / __/ (_| |\ V /| | (_| | || __/ 5 // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| 6 // 7 // Copyright © 2016 - 2024 Weaviate B.V. All rights reserved. 8 // 9 // CONTACT: hello@weaviate.io 10 // 11 12 package objects 13 14 import "strings" 15 16 // determine which field values not to return 17 func determineResponseFields(fields []*string) map[string]struct{} { 18 fieldsToKeep := map[string]struct{}{ 19 "class": {}, "properties": {}, "creationTimeUnix": {}, 20 "lastUpdateTimeUnix": {}, "key": {}, "id": {}, 21 } 22 23 if len(fields) > 0 { 24 // check if "ALL" option is provided 25 for _, field := range fields { 26 fieldToKeep := strings.ToLower(*field) 27 if fieldToKeep == "all" { 28 return fieldsToKeep 29 } 30 } 31 32 fieldsToKeep = make(map[string]struct{}) 33 // iterate over the provided fields 34 for _, field := range fields { 35 fieldToKeep := strings.ToLower(*field) 36 fieldsToKeep[fieldToKeep] = struct{}{} 37 } 38 } 39 40 return fieldsToKeep 41 }