// VariableName returns the variable name for the given value.
505246
func (p *patternNames) VariableName(value string) string {
	num, ok := p.values[value]
	if !ok {
		if p.values == nil {
			p.values = make(map[string]int)
		}
		num = p.last
		p.last++
		p.values[value] = num
	}
	return fmt.Sprintf("%s%d", p.prefix, num)
}
1227796
func (c *Configure) StringVar(value *string, name string, def string, description string) {
	c.option(value, name, def, description, stringType)
}
1157791
func (v *Variable) String() string {
	if l := len(v.Data); l > 0 && v.Data[l-1] == 0x00 {
		return string(v.Data[:l-1])
	}
	return string(v.Data)
}
929609
func (r *Rets) ErrorVarName() string {
	if r.ReturnsError {
		return "err"
	}
	if r.Type == "error" {
		return r.Name
	}
	return ""
}
142339
public final int getVariableByName(String variableName) {
    int index = getVariableIndex(variableName);
    if (index == -1) {
      return index;
    } else {
      return nums[index];
    }
  }
406867
func (c *Command) Name() string {
	name := c.Use
	i := strings.Index(name, " ")
	if i >= 0 {
		name = name[:i]
	}
	return name
}
1140830
func (i *Info) ObjectName() string {
	if i.Mapping != nil {
		return fmt.Sprintf("%s/%s", i.Mapping.Resource.Resource, i.Name)
	}
	gvk := i.Object.GetObjectKind().GroupVersionKind()
	if len(gvk.Group) == 0 {
		return fmt.Sprintf("%s/%s", strings.ToLower(gvk.Kind), i.Name)
	}
	return fmt.Sprintf("%s.%s/%s\n", strings.ToLower(gvk.Kind), gvk.Group, i.Name)
}
1047559
func (n *Interface) GetName() (string, error) {
	var err C.virError
	result := C.virInterfaceGetNameWrapper(n.ptr, &err)
	if result == nil {
		return "", makeError(&err)
	}
	name := C.GoString(result)
	return name, nil
}
1079848
func parseVariable(parser *Parser) (*ast.Variable, error) {
	var (
		err  error
		name *ast.Name
	)
	start := parser.Token.Start
	if _, err = expect(parser, lexer.DOLLAR); err != nil {
		return nil, err
	}
	if name, err = parseName(parser); err != nil {
		return nil, err
	}
	return ast.NewVariable(&ast.Variable{
		Name: name,
		Loc:  loc(parser, start),
	}), nil
}
148452
func (s *Scheduler) Var() expvar.Var {
	return expvar.Func(func() interface{} {
		s.callbackMutex.Lock()
		defer s.callbackMutex.Unlock()
		return s.previousDatapoints
	})
}
1051351
func (f *FlagSet) Var(value flag.Value, name, usage string) {
	f.mainSet.Var(value, name, usage)
	f.flagSet.Var(value, name, usage)
}
326156
func (s *VariableService) UpdateVariable(ctx context.Context, id platform.ID, update *platform.VariableUpdate) (*platform.Variable, error) {
	u, err := newURL(s.Addr, variableIDPath(id))
	if err != nil {
		return nil, err
	}

	octets, err := json.Marshal(update)
	if err != nil {
		return nil, err
	}

	req, err := http.NewRequest("PATCH", u.String(), bytes.NewReader(octets))
	if err != nil {
		return nil, err
	}

	req.Header.Set("Content-Type", "application/json")
	SetToken(s.Token, req)

	hc := newClient(u.Scheme, s.InsecureSkipVerify)

	resp, err := hc.Do(req)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	if err := CheckError(resp); err != nil {
		return nil, err
	}

	var m platform.Variable
	if err := json.NewDecoder(resp.Body).Decode(&m); err != nil {
		return nil, err
	}

	return &m, nil
}
448270
func (v *Argument) GetName() (o string) {
	if v != nil {
		o = v.Name
	}
	return
}
541985
func (v variableValue) compare(rhs variableValue) int {
	if v.I != nil {
		if rhs.I != nil {
			// Both integers.
			if *v.I < *rhs.I {
				return 1
			} else if *v.I > *rhs.I {
				return -1
			}
			return 0
		} else if rhs.S != nil {
			// int vs string
			return 1
		}
		// int vs Unbound.
		return -1
	} else if v.S != nil {
		if rhs.S != nil {
			// Both strings.
			if *v.S < *rhs.S {
				return 1
			} else if *v.S > *rhs.S {
				return -1
			}
			return 0
		}
		// string vs (int | unbound)
		return -1
	} else if rhs.isBound() {
		// unbound vs (int|string)
		return 1
	}
	// unbound vs unbound
	return 0
}
88120
func (s *VariableService) ReplaceVariable(ctx context.Context, m *influxdb.Variable) error {
	m, err := s.FindVariableByID(ctx, m.ID)
	if err != nil {
		return err
	}

	if err := authorizeWriteVariable(ctx, m.OrganizationID, m.ID); err != nil {
		return err
	}

	return s.s.ReplaceVariable(ctx, m)
}
552960
func (ctx *Context) GetVarNames() (names []string) {
	for name, _ := range ctx.GetAllVars() {
		names = append(names, name)
	}

	sort.Strings(names)
	return
}
1046167
func getVariableValue(schema Schema, definitionAST *ast.VariableDefinition, input interface{}) (interface{}, error) {
	ttype, err := typeFromAST(schema, definitionAST.Type)
	if err != nil {
		return nil, err
	}
	variable := definitionAST.Variable

	if ttype == nil || !IsInputType(ttype) {
		return "", gqlerrors.NewError(
			fmt.Sprintf(`Variable "$%v" expected value of type `+
				`"%v" which cannot be used as an input type.`, variable.Name.Value, printer.Print(definitionAST.Type)),
			[]ast.Node{definitionAST},
			"",
			nil,
			[]int{},
			nil,
		)
	}

	isValid, messages := isValidInputValue(input, ttype)
	if isValid {
		if isNullish(input) {
			if definitionAST.DefaultValue != nil {
				return valueFromAST(definitionAST.DefaultValue, ttype, nil), nil
			}
		}
		return coerceValue(ttype, input), nil
	}
	if isNullish(input) {
		return "", gqlerrors.NewError(
			fmt.Sprintf(`Variable "$%v" of required type `+
				`"%v" was not provided.`, variable.Name.Value, printer.Print(definitionAST.Type)),
			[]ast.Node{definitionAST},
			"",
			nil,
			[]int{},
			nil,
		)
	}
	// convert input interface into string for error message
	bts, _ := json.Marshal(input)
	var (
		inputStr = string(bts)
		msg      string
	)
	if len(messages) > 0 {
		msg = "\n" + strings.Join(messages, "\n")
	}

	return "", gqlerrors.NewError(
		fmt.Sprintf(`Variable "$%v" got invalid value `+
			`%v.%v`, variable.Name.Value, inputStr, msg),
		[]ast.Node{definitionAST},
		"",
		nil,
		[]int{},
		nil,
	)
}