// TimestampNamed adds a USING TIMESTAMP clause to the query with a custom
// parameter name.
508355
func (b *InsertBuilder) TimestampNamed(name string) *InsertBuilder {
	b.using.TimestampNamed(name)
	return b
}
1278957
func (b *DeleteBuilder) TimestampNamed(name string) *DeleteBuilder {
	b.using.TimestampNamed(name)
	return b
}
103347
func LtOrEqNamed(column, name string) Cmp {
	return Cmp{
		op:     leq,
		column: column,
		value:  param(name),
	}
}
375642
func TabletDbName(tablet *topodatapb.Tablet) string {
	if tablet.DbNameOverride != "" {
		return tablet.DbNameOverride
	}
	if tablet.Keyspace == "" {
		return ""
	}
	return vtDbPrefix + tablet.Keyspace
}
1100490
func GtNamed(column, name string) Cmp {
	return Cmp{
		op:     gt,
		column: column,
		value:  param(name),
	}
}
599847
func GetNamed(ttype Type) Named {
	unmodifiedType := ttype
	for {
		switch typ := unmodifiedType.(type) {
		case *List:
			unmodifiedType = typ.OfType
		case *NonNull:
			unmodifiedType = typ.OfType
		default:
			return unmodifiedType
		}
	}
}
1292924
func (e *EnumDescriptor) GetNamedValue(name string) *EnumValueDescriptor {
	for _, v := range e.GetValues() {
		if v.GetName() == name {
			return v
		}
	}

	return nil
}
699198
func (l *HandlerList) SwapNamed(n NamedHandler) (swapped bool) {
	for i := 0; i < len(l.list); i++ {
		if l.list[i].Name == n.Name {
			l.list[i].Fn = n.Fn
			swapped = true
		}
	}

	return swapped
}
225841
func Named(query string, arg interface{}) (string, []interface{}, error) {
	return bindNamedMapper(QUESTION, query, arg, mapper())
}
304054
func (p *Postgres) createDataSourceName() string {
	parameters := []string{}

	addParam := func(key, val string) {
		parameters = append(parameters, fmt.Sprintf("%s=%s", key, val))
	}

	addParam("connect_timeout", strconv.Itoa(p.ConnectionTimeout))

	// detect host:port for backwards-compatibility
	host, port, err := net.SplitHostPort(p.Host)
	if err != nil {
		// not host:port, probably unix socket or bare address

		host = p.Host

		if p.Port != 0 {
			port = strconv.Itoa(int(p.Port))
		}
	}

	if host != "" {
		addParam("host", dataSourceStr(host))
	}

	if port != "" {
		addParam("port", port)
	}

	if p.User != "" {
		addParam("user", dataSourceStr(p.User))
	}

	if p.Password != "" {
		addParam("password", dataSourceStr(p.Password))
	}

	if p.Database != "" {
		addParam("dbname", dataSourceStr(p.Database))
	}

	if p.SSL.Mode == "" {
		// Assume the strictest mode if unspecified.
		addParam("sslmode", dataSourceStr(sslVerifyFull))
	} else {
		addParam("sslmode", dataSourceStr(p.SSL.Mode))
	}

	if p.SSL.CAFile != "" {
		addParam("sslrootcert", dataSourceStr(p.SSL.CAFile))
	}

	if p.SSL.CertFile != "" {
		addParam("sslcert", dataSourceStr(p.SSL.CertFile))
	}

	if p.SSL.KeyFile != "" {
		addParam("sslkey", dataSourceStr(p.SSL.KeyFile))
	}

	return strings.Join(parameters, " ")
}
1227934
func EqNamed(column, name string) Cmp {
	return Cmp{
		op:     eq,
		column: column,
		value:  param(name),
	}
}
983697
func (b *UpdateBuilder) Timestamp(t time.Time) *UpdateBuilder {
	b.using.Timestamp(t)
	return b
}
854816
func (g *Plugin) objectNamed(name string) generator.Object {
	g.gen.RecordTypeUse(name)
	return g.gen.ObjectNamed(name)
}
374177
func (c *ChatUpdateCall) Timestamp(timestamp string) *ChatUpdateCall {
	c.timestamp = timestamp
	return c
}
6457
func (b *UpdateBuilder) RemoveNamed(column, name string) *UpdateBuilder {
	return b.removeValue(column, param(name))
}
83534
func MysqlHostname(tablet *topodatapb.Tablet) string {
	if tablet.MysqlHostname == "" {
		return tablet.Hostname
	}
	return tablet.MysqlHostname
}
262557
func (sh *Handler) getNamed(ctx context.Context, name string) (string, error) {
	if sh.fetcher == nil {
		return "", fmt.Errorf("GetNamed functionality not available")
	}
	sr, err := sh.Query(ctx, NamedSearch(name))
	if err != nil {
		return "", err
	}

	if len(sr.Blobs) < 1 {
		return "", fmt.Errorf("No named search found for: %s", name)
	}
	permaRef := sr.Blobs[0].Blob
	substRefS := sr.Describe.Meta.Get(permaRef).Permanode.Attr.Get("camliContent")
	br, ok := blob.Parse(substRefS)
	if !ok {
		return "", fmt.Errorf("Invalid blob ref: %s", substRefS)
	}

	reader, _, err := sh.fetcher.Fetch(ctx, br)
	if err != nil {
		return "", err
	}
	result, err := ioutil.ReadAll(reader)
	if err != nil {
		return "", err
	}
	return string(result), nil
}