// URLJoinBy that's convenient.
487727
func (u URL) URLJoinBy(key string, joins ...string) URL {
	var values []string
	for _, k := range joins {
		var vals interface{}
		for _, v := range u {
			if v[0] == k {
				vals = v[1]
				break
			}
		}
		values = append(values, fmt.Sprint(vals))
	}
	var index int
	var v []interface{}
	for index, v = range u {
		if v[0] == key {
			break
		}
	}
	u[index][1] = URLJoin("", values...)
	return u
}
723730
func (d *Dataset) JoinByKey(name string, other *Dataset) *Dataset {
	return d.DoJoin(name, other, false, false, Field(1))
}
1203314
func JoinURLFragments(a, b string) string {
	aslash := strings.HasSuffix(a, "/")
	bslash := strings.HasPrefix(b, "/")

	if len(b) == 0 {
		return a
	}

	switch {
	case aslash && bslash:
		return a + b[1:]
	case !aslash && !bslash:
		return a + "/" + b
	}
	return a + b
}
376600
func (t Term) OuterJoin(args ...interface{}) Term {
	return constructMethodTerm(t, "OuterJoin", p.Term_OUTER_JOIN, args, map[string]interface{}{})
}
347946
func (a *aggPushDownSolver) checkValidJoin(join *Join) bool {
	return join.JoinType == InnerJoin || join.JoinType == LeftOuterJoin || join.JoinType == RightOuterJoin
}
796469
func (me *Dataset) InnerJoin(table Expression, condition joinExpression) *Dataset {
	return me.joinTable(INNER_JOIN, table, condition)
}
1208190
func (s *SelectQuery) InnerJoin(table string, on Expression) *SelectQuery {
	return s.Join("INNER JOIN", table, on)
}
773875
func (s *Sandbox) NetNsJoin(nspath, name string) error {
	if s.netns != nil {
		return fmt.Errorf("sandbox already has a network namespace, cannot join another")
	}

	netNS, err := s.NetNsGet(nspath, name)
	if err != nil {
		return err
	}

	s.netns = netNS

	return nil
}
1010778
func (s *SelectQuery) LeftJoin(table string, on Expression) *SelectQuery {
	return s.Join("LEFT JOIN", table, on)
}
881737
func (s *IndicesForcemergeService) buildURL() (string, url.Values, error) {
	var err error
	var path string

	// Build URL
	if len(s.index) > 0 {
		path, err = uritemplates.Expand("/{index}/_forcemerge", map[string]string{
			"index": strings.Join(s.index, ","),
		})
	} else {
		path = "/_forcemerge"
	}
	if err != nil {
		return "", url.Values{}, err
	}

	// Add query string parameters
	params := url.Values{}
	if s.pretty {
		params.Set("pretty", "true")
	}
	if s.allowNoIndices != nil {
		params.Set("allow_no_indices", fmt.Sprintf("%v", *s.allowNoIndices))
	}
	if s.expandWildcards != "" {
		params.Set("expand_wildcards", s.expandWildcards)
	}
	if s.flush != nil {
		params.Set("flush", fmt.Sprintf("%v", *s.flush))
	}
	if s.ignoreUnavailable != nil {
		params.Set("ignore_unavailable", fmt.Sprintf("%v", *s.ignoreUnavailable))
	}
	if s.maxNumSegments != nil {
		params.Set("max_num_segments", fmt.Sprintf("%v", s.maxNumSegments))
	}
	if s.onlyExpungeDeletes != nil {
		params.Set("only_expunge_deletes", fmt.Sprintf("%v", *s.onlyExpungeDeletes))
	}
	return path, params, nil
}
1044027
func URLFunc(v string) (interface{}, error) {
	u, err := url.Parse(v)
	if err != nil {
		return nil, fmt.Errorf("unable parse URL: %v", err)
	}
	return *u, nil
}
250954
func (rb *route) MergeSubquery(pb *primitiveBuilder, inner *route) bool {
	var mergedRouteOptions []*routeOption
outer:
	for _, lro := range rb.routeOptions {
		for _, rro := range inner.routeOptions {
			if lro.SubqueryCanMerge(pb, rro) {
				lro.MergeSubquery(rro)
				mergedRouteOptions = append(mergedRouteOptions, lro)
				continue outer
			}
		}
	}
	if len(mergedRouteOptions) != 0 {
		rb.routeOptions = mergedRouteOptions
		inner.Redirect = rb
		return true
	}
	return false
}
773671
func (nr *nameResolver) handleJoin(j *ast.Join) {
	if j.Right == nil {
		j.SetResultFields(j.Left.GetResultFields())
		return
	}
	leftLen := len(j.Left.GetResultFields())
	rightLen := len(j.Right.GetResultFields())
	rfs := make([]*ast.ResultField, leftLen+rightLen)
	copy(rfs, j.Left.GetResultFields())
	copy(rfs[leftLen:], j.Right.GetResultFields())
	j.SetResultFields(rfs)
}
228548
func SecureJoin(root, unsafePath string) (string, error) {
	return SecureJoinVFS(root, unsafePath, nil)
}
1258128
func (b *Builder) RightJoin(joinTable string, joinCond interface{}) *Builder {
	return b.Join("RIGHT", joinTable, joinCond)
}
723181
func SafeJoin(paths ...string) (string, error) {
	result := path.Join(paths...)
	// check filepath
	if !strings.HasPrefix(result, filepath.Clean(paths[0])+string(os.PathSeparator)) {
		return "", errors.New("invalid filepath")
	}

	return result, nil
}
324891
func (cr *Context) GetLineJoin() LineJoin {
	ret := LineJoin(C.cairo_get_line_join(cr.Ptr))
	if err := cr.status(); err != nil {
		panic(err)
	}
	return ret
}