From 98c423480e48b7e0d9c6f3b9e4e7dde9eb8f5d84 Mon Sep 17 00:00:00 2001 From: "zhenshan.cao" Date: Thu, 23 Sep 2021 22:37:54 +0800 Subject: [PATCH] [skip ci] Add comments for indexparamcheck (#8436) Signed-off-by: zhenshan.cao --- internal/util/indexparamcheck/utils.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/util/indexparamcheck/utils.go b/internal/util/indexparamcheck/utils.go index 00e4233c77..6cafb37fa3 100644 --- a/internal/util/indexparamcheck/utils.go +++ b/internal/util/indexparamcheck/utils.go @@ -6,6 +6,9 @@ import ( "github.com/milvus-io/milvus/internal/util/funcutil" ) +// Check whether the data corresponding to the key is within the range of [min, max]. +// If the key does not exist, or the data cannot be converted to an int type number, or the number is not in the range [min, max], return false +// Otherwise, return true func CheckIntByRange(params map[string]string, key string, min, max int) bool { valueStr, ok := params[key] if !ok { @@ -20,6 +23,9 @@ func CheckIntByRange(params map[string]string, key string, min, max int) bool { return value >= min && value <= max } +// Check whether the data corresponding to the key appears in the string slice of container. +// If the key does not exist, or the data does not appear in the container, return false +// Otherwise return true func CheckStrByValues(params map[string]string, key string, container []string) bool { value, ok := params[key] if !ok {