mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
drop ft.profile that was never enabled (#3323)
This commit is contained in:
@ -2090,216 +2090,3 @@ func (c cmdable) FTTagVals(ctx context.Context, index string, field string) *Str
|
||||
_ = c(ctx, cmd)
|
||||
return cmd
|
||||
}
|
||||
|
||||
// TODO: remove FTProfile
|
||||
// type FTProfileResult struct {
|
||||
// Results []interface{}
|
||||
// Profile ProfileDetails
|
||||
// }
|
||||
|
||||
// type ProfileDetails struct {
|
||||
// TotalProfileTime string
|
||||
// ParsingTime string
|
||||
// PipelineCreationTime string
|
||||
// Warning string
|
||||
// IteratorsProfile []IteratorProfile
|
||||
// ResultProcessorsProfile []ResultProcessorProfile
|
||||
// }
|
||||
|
||||
// type IteratorProfile struct {
|
||||
// Type string
|
||||
// QueryType string
|
||||
// Time interface{}
|
||||
// Counter int
|
||||
// Term string
|
||||
// Size int
|
||||
// ChildIterators []IteratorProfile
|
||||
// }
|
||||
|
||||
// type ResultProcessorProfile struct {
|
||||
// Type string
|
||||
// Time interface{}
|
||||
// Counter int
|
||||
// }
|
||||
|
||||
// func parseFTProfileResult(data []interface{}) (FTProfileResult, error) {
|
||||
// var result FTProfileResult
|
||||
// if len(data) < 2 {
|
||||
// return result, fmt.Errorf("unexpected data length")
|
||||
// }
|
||||
|
||||
// // Parse results
|
||||
// result.Results = data[0].([]interface{})
|
||||
|
||||
// // Parse profile details
|
||||
// profileData := data[1].([]interface{})
|
||||
// profileDetails := ProfileDetails{}
|
||||
// for i := 0; i < len(profileData); i += 2 {
|
||||
// switch profileData[i].(string) {
|
||||
// case "Total profile time":
|
||||
// profileDetails.TotalProfileTime = profileData[i+1].(string)
|
||||
// case "Parsing time":
|
||||
// profileDetails.ParsingTime = profileData[i+1].(string)
|
||||
// case "Pipeline creation time":
|
||||
// profileDetails.PipelineCreationTime = profileData[i+1].(string)
|
||||
// case "Warning":
|
||||
// profileDetails.Warning = profileData[i+1].(string)
|
||||
// case "Iterators profile":
|
||||
// profileDetails.IteratorsProfile = parseIteratorsProfile(profileData[i+1].([]interface{}))
|
||||
// case "Result processors profile":
|
||||
// profileDetails.ResultProcessorsProfile = parseResultProcessorsProfile(profileData[i+1].([]interface{}))
|
||||
// }
|
||||
// }
|
||||
|
||||
// result.Profile = profileDetails
|
||||
// return result, nil
|
||||
// }
|
||||
|
||||
// func parseIteratorsProfile(data []interface{}) []IteratorProfile {
|
||||
// var iterators []IteratorProfile
|
||||
// for _, item := range data {
|
||||
// profile := item.([]interface{})
|
||||
// iterator := IteratorProfile{}
|
||||
// for i := 0; i < len(profile); i += 2 {
|
||||
// switch profile[i].(string) {
|
||||
// case "Type":
|
||||
// iterator.Type = profile[i+1].(string)
|
||||
// case "Query type":
|
||||
// iterator.QueryType = profile[i+1].(string)
|
||||
// case "Time":
|
||||
// iterator.Time = profile[i+1]
|
||||
// case "Counter":
|
||||
// iterator.Counter = int(profile[i+1].(int64))
|
||||
// case "Term":
|
||||
// iterator.Term = profile[i+1].(string)
|
||||
// case "Size":
|
||||
// iterator.Size = int(profile[i+1].(int64))
|
||||
// case "Child iterators":
|
||||
// iterator.ChildIterators = parseChildIteratorsProfile(profile[i+1].([]interface{}))
|
||||
// }
|
||||
// }
|
||||
// iterators = append(iterators, iterator)
|
||||
// }
|
||||
// return iterators
|
||||
// }
|
||||
|
||||
// func parseChildIteratorsProfile(data []interface{}) []IteratorProfile {
|
||||
// var iterators []IteratorProfile
|
||||
// for _, item := range data {
|
||||
// profile := item.([]interface{})
|
||||
// iterator := IteratorProfile{}
|
||||
// for i := 0; i < len(profile); i += 2 {
|
||||
// switch profile[i].(string) {
|
||||
// case "Type":
|
||||
// iterator.Type = profile[i+1].(string)
|
||||
// case "Query type":
|
||||
// iterator.QueryType = profile[i+1].(string)
|
||||
// case "Time":
|
||||
// iterator.Time = profile[i+1]
|
||||
// case "Counter":
|
||||
// iterator.Counter = int(profile[i+1].(int64))
|
||||
// case "Term":
|
||||
// iterator.Term = profile[i+1].(string)
|
||||
// case "Size":
|
||||
// iterator.Size = int(profile[i+1].(int64))
|
||||
// }
|
||||
// }
|
||||
// iterators = append(iterators, iterator)
|
||||
// }
|
||||
// return iterators
|
||||
// }
|
||||
|
||||
// func parseResultProcessorsProfile(data []interface{}) []ResultProcessorProfile {
|
||||
// var processors []ResultProcessorProfile
|
||||
// for _, item := range data {
|
||||
// profile := item.([]interface{})
|
||||
// processor := ResultProcessorProfile{}
|
||||
// for i := 0; i < len(profile); i += 2 {
|
||||
// switch profile[i].(string) {
|
||||
// case "Type":
|
||||
// processor.Type = profile[i+1].(string)
|
||||
// case "Time":
|
||||
// processor.Time = profile[i+1]
|
||||
// case "Counter":
|
||||
// processor.Counter = int(profile[i+1].(int64))
|
||||
// }
|
||||
// }
|
||||
// processors = append(processors, processor)
|
||||
// }
|
||||
// return processors
|
||||
// }
|
||||
|
||||
// func NewFTProfileCmd(ctx context.Context, args ...interface{}) *FTProfileCmd {
|
||||
// return &FTProfileCmd{
|
||||
// baseCmd: baseCmd{
|
||||
// ctx: ctx,
|
||||
// args: args,
|
||||
// },
|
||||
// }
|
||||
// }
|
||||
|
||||
// type FTProfileCmd struct {
|
||||
// baseCmd
|
||||
// val FTProfileResult
|
||||
// }
|
||||
|
||||
// func (cmd *FTProfileCmd) String() string {
|
||||
// return cmdString(cmd, cmd.val)
|
||||
// }
|
||||
|
||||
// func (cmd *FTProfileCmd) SetVal(val FTProfileResult) {
|
||||
// cmd.val = val
|
||||
// }
|
||||
|
||||
// func (cmd *FTProfileCmd) Result() (FTProfileResult, error) {
|
||||
// return cmd.val, cmd.err
|
||||
// }
|
||||
|
||||
// func (cmd *FTProfileCmd) Val() FTProfileResult {
|
||||
// return cmd.val
|
||||
// }
|
||||
|
||||
// func (cmd *FTProfileCmd) readReply(rd *proto.Reader) (err error) {
|
||||
// data, err := rd.ReadSlice()
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// cmd.val, err = parseFTProfileResult(data)
|
||||
// if err != nil {
|
||||
// cmd.err = err
|
||||
// }
|
||||
// return nil
|
||||
// }
|
||||
|
||||
// // FTProfile - Executes a search query and returns a profile of how the query was processed.
|
||||
// // The 'index' parameter specifies the index to search, the 'limited' parameter specifies whether to limit the results,
|
||||
// // and the 'query' parameter specifies the search / aggreagte query. Please notice that you must either pass a SearchQuery or an AggregateQuery.
|
||||
// // For more information, please refer to the Redis documentation:
|
||||
// // [FT.PROFILE]: (https://redis.io/commands/ft.profile/)
|
||||
// func (c cmdable) FTProfile(ctx context.Context, index string, limited bool, query interface{}) *FTProfileCmd {
|
||||
// queryType := ""
|
||||
// var argsQuery []interface{}
|
||||
|
||||
// switch v := query.(type) {
|
||||
// case AggregateQuery:
|
||||
// queryType = "AGGREGATE"
|
||||
// argsQuery = v
|
||||
// case SearchQuery:
|
||||
// queryType = "SEARCH"
|
||||
// argsQuery = v
|
||||
// default:
|
||||
// panic("FT.PROFILE: query must be either AggregateQuery or SearchQuery")
|
||||
// }
|
||||
|
||||
// args := []interface{}{"FT.PROFILE", index, queryType}
|
||||
|
||||
// if limited {
|
||||
// args = append(args, "LIMITED")
|
||||
// }
|
||||
// args = append(args, "QUERY")
|
||||
// args = append(args, argsQuery...)
|
||||
|
||||
// cmd := NewFTProfileCmd(ctx, args...)
|
||||
// _ = c(ctx, cmd)
|
||||
// return cmd
|
||||
// }
|
||||
|
Reference in New Issue
Block a user