我有這個(gè)功能。func OrderedParamsFromUri(uri string) []string { matches := pathParamRE.FindAllStringSubmatch(uri, -1) result := make([]string, len(matches)) for i, m := range matches { result[i] = m[1] } return result}我想在我的模板中使用這個(gè)函數(shù)來(lái)檢查返回的是否result包含項(xiàng)目。我知道我可以做這樣的事情: ( .OperationId | OrderedParamsFromUri | //here i want to check for the empty slice) .OperationId => this is the argument.我知道我可以檢查返回的切片是否為空if not .returnedSlice 但是如何將這兩者結(jié)合起來(lái)?
go template:如何將函數(shù)返回的變量傳遞給管道中的下一個(gè)命令
BIG陽(yáng)
2022-06-01 18:12:31