// GetPrefix returns the first key which matches the prefix and its value
517533
func (c *consulClient) GetPrefix(ctx context.Context, prefix string) (string, []byte, error) {
	duration := spanstat.Start()
	opts := &consulAPI.QueryOptions{}
	pairs, _, err := c.KV().List(prefix, opts.WithContext(ctx))
	increaseMetric(prefix, metricRead, "GetPrefix", duration.EndError(err).Total(), err)
	if err != nil {
		return "", nil, err
	}

	if len(pairs) == 0 {
		return "", nil, nil
	}

	return pairs[0].Key, pairs[0].Value, nil
}
460516
func (s *MetricsAndOperator) SetPrefix(v string) *MetricsAndOperator {
	s.Prefix = &v
	return s
}
314665
func (l *Logger) PopPrefix() {
	if len(l.prefixStack) == 0 {
		l.Debug("popped from empty stack")
		return
	}
	l.prefixStack = l.prefixStack[:len(l.prefixStack)-1]
}
1054981
func (v *GenerateServiceRequest) GetPackagePrefix() (o string) {
	if v != nil {
		o = v.PackagePrefix
	}
	return
}
1285033
func (s *ListObjectsOutput) SetPrefix(v string) *ListObjectsOutput {
	s.Prefix = &v
	return s
}
540960
func (s *ListObjectsV2Output) SetPrefix(v string) *ListObjectsV2Output {
	s.Prefix = &v
	return s
}
2321
func (r *Router) WithPrefix(prefix string) *Router {
	return &Router{rtr: r.rtr, prefix: r.prefix + prefix, instrh: r.instrh}
}
1181795
func parsePrefix(s string) (string, string) {
	if strings.HasPrefix(s, "P") {
		return "P", s[1:]
	}
	if len(s) < 2 {
		return s, ""
	}
	return s[:2], s[2:]
}
848741
func parsePrefix(req *http.Request, b *structs.QueryOptions) {
	query := req.URL.Query()
	if prefix := query.Get("prefix"); prefix != "" {
		b.Prefix = prefix
	}
}
1227143
func getValidPrefix(s string, base int64) string {
	var (
		validLen int
		upper    rune
	)
	switch {
	case base >= 2 && base <= 9:
		upper = rune('0' + base)
	case base <= 36:
		upper = rune('A' + base - 10)
	default:
		return ""
	}
Loop:
	for i := 0; i < len(s); i++ {
		c := rune(s[i])
		switch {
		case unicode.IsDigit(c) || unicode.IsLower(c) || unicode.IsUpper(c):
			c = unicode.ToUpper(c)
			if c < upper {
				validLen = i + 1
			} else {
				break Loop
			}
		case c == '+' || c == '-':
			if i != 0 {
				break Loop
			}
		default:
			break Loop
		}
	}
	if validLen > 1 && s[0] == '+' {
		return s[1:validLen]
	}
	return s[:validLen]
}
405435
func (c *config) determinePrefix(prefixFlag string) {
	// CLI takes precedence over config
	if len(prefixFlag) > 0 {
		c.prefix = prefixFlag
		return
	}
	// If prefix is not configured, it is equal to prefix: true
	if c.RawPrefix == nil {
		c.RawPrefix = true
	}
	// Use configured prefix:
	// true -> folder name
	// false -> no prefix
	// string -> use as-is
	switch concretePrefix := c.RawPrefix.(type) {
	case bool:
		if concretePrefix {
			c.prefix = filepath.Base(c.path) + "_"
		} else {
			c.prefix = ""
		}
	case string:
		c.prefix = expandEnv(concretePrefix)
	default:
		panic(StatusError{fmt.Errorf("prefix must be either string or boolean, got %s", c.RawPrefix), 65})
	}
}
776891
func (iter *Iterator) ValidForPrefix(prefix []byte) bool {
	if C.rocksdb_iter_valid(iter.c) == 0 {
		return false
	}

	key := iter.Key()
	result := bytes.HasPrefix(key.Data(), prefix)
	key.Free()
	return result
}
259903
func (r *readerOffsets) searchPrefix(n int) int {
	i, j := 0, len(r.prefixes)
	for i < j {
		h := int(uint(i+j) >> 1)
		if n >= r.prefixes[h].total {
			i = h + 1
		} else {
			j = h
		}
	}
	return i
}
860816
func (az *Cloud) getRulePrefix(service *v1.Service) string {
	return az.GetLoadBalancerName(context.TODO(), "", service)
}
876197
func (s *S3Location) SetPrefix(v string) *S3Location {
	s.Prefix = &v
	return s
}
521188
func (s *Client) SetPrefix(prefix string) {
	if s == nil {
		return
	}

	s.prefix = prefix
}
274810
func (s *S3ResourceClassificationUpdate) SetPrefix(v string) *S3ResourceClassificationUpdate {
	s.Prefix = &v
	return s
}