• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang field.RFQNames函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/pingcap/tidb/field.RFQNames函数的典型用法代码示例。如果您正苦于以下问题:Golang RFQNames函数的具体用法?Golang RFQNames怎么用?Golang RFQNames使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了RFQNames函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: Explain

// Explain implements the plan.Plan Explain interface.
func (r *TableDefaultPlan) Explain(w format.Formatter) {
	fmtStr := "┌Iterate all rows of table %q\n└Output field names %v\n"
	if r.rangeScan {
		fmtStr = "┌Range scan rows of table %q\n└Output field names %v\n"
	}
	w.Format(fmtStr, r.T.TableName(), field.RFQNames(r.Fields))
}
开发者ID:lovedboy,项目名称:tidb,代码行数:8,代码来源:from.go


示例2: Explain

// Explain implements the plan.Plan Explain interface.
func (r *SelectFinalPlan) Explain(w format.Formatter) {
	r.Src.Explain(w)
	if r.HiddenFieldOffset == len(r.Src.GetFields()) {
		// we have no hidden fields, can return.
		return
	}
	w.Format("┌Evaluate\n└Output field names %v\n", field.RFQNames(r.ResultFields[0:r.HiddenFieldOffset]))
}
开发者ID:superwood,项目名称:tidb,代码行数:9,代码来源:final.go


示例3: Explain

// Explain implements the plan.Plan Explain interface.
func (r *SelectFieldsDefaultPlan) Explain(w format.Formatter) {
	// TODO: check for non existing fields
	r.Src.Explain(w)
	w.Format("┌Evaluate")
	for _, v := range r.Fields {
		w.Format(" %s,", v)
	}
	w.Format("\n└Output field names %v\n", field.RFQNames(r.ResultFields))
}
开发者ID:H0bby,项目名称:tidb,代码行数:10,代码来源:fields.go


示例4: explainNode

func (r *JoinPlan) explainNode(w format.Formatter, node plan.Plan) {
	sel := !isTableOrIndex(node)
	if sel {
		w.Format("┌Iterate all rows of virtual table\n")
	}
	node.Explain(w)
	if sel {
		w.Format("└Output field names %v\n", field.RFQNames(node.GetFields()))
	}

}
开发者ID:studygolang,项目名称:tidb,代码行数:11,代码来源:join.go


示例5: Explain

// Explain implements plan.Plan Explain interface.
func (r *JoinPlan) Explain(w format.Formatter) {
	// TODO: show more useful join plan
	if r.Right == nil {
		// if right is nil, we don't do a join, just simple select table
		r.Left.Explain(w)
		return
	}

	w.Format("┌Compute %s Cartesian product of\n", r.Type)

	r.explainNode(w, r.Left)
	r.explainNode(w, r.Right)

	w.Format("└Output field names %v\n", field.RFQNames(r.Fields))
}
开发者ID:studygolang,项目名称:tidb,代码行数:16,代码来源:join.go


示例6: Explain

// Explain implements plan.Plan Explain interface.
func (r *indexPlan) Explain(w format.Formatter) {
	w.Format("┌Iterate rows of table %q using index %q where %s in ", r.src.TableName(), r.idxName, r.col.Name.L)
	for _, span := range r.spans {
		open := "["
		close := "]"
		if span.lowExclude {
			open = "("
		}
		if span.highExclude {
			close = ")"
		}
		w.Format("%s%v,%v%s ", open, span.lowVal, span.highVal, close)
	}
	w.Format("\n└Output field names %v\n", field.RFQNames(r.GetFields()))
}
开发者ID:kevinhuo88888,项目名称:tidb,代码行数:16,代码来源:index.go


示例7: Explain

// Explain implements plan.Plan Explain interface.
func (r *OrderByDefaultPlan) Explain(w format.Formatter) {
	r.Src.Explain(w)
	w.Format("┌Order by")

	items := make([]string, len(r.By))
	for i, v := range r.By {
		order := "ASC"
		if !r.Ascs[i] {
			order = "DESC"
		}
		items[i] = fmt.Sprintf(" %s %s", v, order)
	}
	w.Format("%s", strings.Join(items, ","))
	w.Format("\n└Output field names %v\n", field.RFQNames(r.ResultFields))
}
开发者ID:no2key,项目名称:tidb,代码行数:16,代码来源:orderby.go


示例8: Explain

// Explain implements plan.Plan Explain interface.
func (r *GroupByDefaultPlan) Explain(w format.Formatter) {
	r.Src.Explain(w)
	w.Format("┌Evaluate")
	for _, v := range r.Fields {
		w.Format(" %s as %s,", v.Expr, fmt.Sprintf("%q", v.Name))
	}

	switch {
	case len(r.By) == 0: //TODO this case should not exist for this plan.Plan, should become TableDefaultPlan
		w.Format("\n│Group by distinct rows")
	default:
		w.Format("\n│Group by")
		for _, v := range r.By {
			w.Format(" %s,", v)
		}
	}
	w.Format("\n└Output field names %v\n", field.RFQNames(r.ResultFields))
}
开发者ID:szctop,项目名称:tidb,代码行数:19,代码来源:groupby.go


示例9: Explain

// Explain implements plan.Plan Explain interface.
func (r *NullPlan) Explain(w format.Formatter) {
	w.Format("┌Iterate no rows\n└Output field names %v\n", field.RFQNames(r.Fields))
}
开发者ID:szctop,项目名称:tidb,代码行数:4,代码来源:plans.go


示例10: Explain

// Explain implements plan.Plan Explain interface.
func (r *OffsetDefaultPlan) Explain(w format.Formatter) {
	r.Src.Explain(w)
	w.Format("┌Skip first %d records\n└Output field names %v\n", r.Count, field.RFQNames(r.Fields))
}
开发者ID:ninefive,项目名称:tidb,代码行数:5,代码来源:limit.go


示例11: Explain

// Explain implements the plan.Plan interface.
func (r *TableNilPlan) Explain(w format.Formatter) {
	w.Format("┌Iterate all rows of table %q\n└Output field names %v\n", r.T.TableName(), field.RFQNames(r.GetFields()))
}
开发者ID:hulunbier,项目名称:tidb,代码行数:4,代码来源:from.go


示例12: TestMain

func (*testResultFieldSuite) TestMain(c *C) {
	col := column.Col{
		ColumnInfo: model.ColumnInfo{
			FieldType: *types.NewFieldType(mysql.TypeLong),
			Name:      model.NewCIStr("c1"),
		},
	}
	col.Flag |= mysql.UnsignedFlag

	r := &field.ResultField{
		Col:          col,
		Name:         "c1",
		OrgTableName: "t1",
	}

	c.Assert(r.String(), Equals, "c1")
	r.TableName = "a"
	c.Assert(r.String(), Equals, "a.c1")
	r.DBName = "test"
	c.Assert(r.String(), Equals, "test.a.c1")

	cr := r.Clone()
	c.Assert(r.String(), Equals, cr.String())

	col1 := column.Col{
		ColumnInfo: model.ColumnInfo{
			FieldType: *types.NewFieldType(mysql.TypeLong),
			Name:      model.NewCIStr("c2"),
		},
	}
	col1.Flag |= mysql.UnsignedFlag

	r1 := &field.ResultField{
		Col:          col1,
		Name:         "c2",
		TableName:    "a",
		OrgTableName: "t1",
		DBName:       "test",
	}

	rs := []*field.ResultField{r, r1}
	ns := field.RFQNames(rs)
	c.Assert(ns, HasLen, 2)
	c.Assert(ns[0], Equals, "\"c1\"")
	c.Assert(ns[1], Equals, "\"c2\"")

	col2 := column.Col{
		ColumnInfo: model.ColumnInfo{
			FieldType: *types.NewFieldType(mysql.TypeVarchar),
			Name:      model.NewCIStr("c3"),
		},
	}
	col2.Flag |= mysql.UnsignedFlag
	col3 := column.Col{
		ColumnInfo: model.ColumnInfo{
			FieldType: *types.NewFieldType(mysql.TypeBlob),
			Name:      model.NewCIStr("c4"),
		},
	}
	col3.Flag |= mysql.UnsignedFlag

	cols := []*column.Col{&col, &col1, &col2, &col3}
	rs = field.ColsToResultFields(cols, "t")
	c.Assert(rs, HasLen, 4)
	c.Assert(rs[2].Tp, Equals, mysql.TypeVarString)
	c.Assert(rs[3].Tp, Equals, mysql.TypeBlob)

	// For CheckAmbiguousField
	err := field.CheckAmbiguousField("c1", rs, field.OrgFieldNameFlag)
	c.Assert(err, IsNil)

	col4 := column.Col{
		ColumnInfo: model.ColumnInfo{
			FieldType: *types.NewFieldType(mysql.TypeVarchar),
			Name:      model.NewCIStr("c2"),
		},
	}
	r2 := &field.ResultField{
		Col:          col4,
		Name:         "c22",
		TableName:    "b",
		OrgTableName: "t2",
		DBName:       "test",
	}
	rs = []*field.ResultField{r, r1, r2}
	// r1 and r2 are ambiguous: same column name but different table names
	err = field.CheckAmbiguousField("c2", rs, field.OrgFieldNameFlag)
	c.Assert(err, NotNil)
	// r1 and r2 with different alias name
	err = field.CheckAmbiguousField("c2", rs, field.FieldNameFlag)
	c.Assert(err, IsNil)

	// For CloneFieldByName
	_, err = field.CloneFieldByName("cx", rs, field.OrgFieldNameFlag)
	c.Assert(err, NotNil)
	_, err = field.CloneFieldByName("c2", rs, field.OrgFieldNameFlag)
	c.Assert(err, IsNil)

	// For check all fields name
	names := []string{"cx"}
//.........这里部分代码省略.........
开发者ID:H0bby,项目名称:tidb,代码行数:101,代码来源:result_field_test.go


示例13: Explain

// Explain implements plan.Plan Explain interface.
func (r *FilterDefaultPlan) Explain(w format.Formatter) {
	r.Plan.Explain(w)
	w.Format("┌FilterDefaultPlan Filter on %v\n", r.Expr)
	w.Format("└Output field names %v\n", field.RFQNames(r.GetFields()))
}
开发者ID:hxiaodon,项目名称:tidb,代码行数:6,代码来源:where.go


示例14: TestMain

func (*testResultFieldSuite) TestMain(c *C) {
	col := column.Col{
		ColumnInfo: model.ColumnInfo{
			FieldType: *types.NewFieldType(mysql.TypeLong),
			Name:      model.NewCIStr("c1"),
		},
	}
	col.Flag |= mysql.UnsignedFlag

	r := &field.ResultField{
		Col:          col,
		Name:         "c1",
		OrgTableName: "t1",
	}

	c.Assert(r.String(), Equals, "c1")
	r.TableName = "a"
	c.Assert(r.String(), Equals, "a.c1")
	r.DBName = "test"
	c.Assert(r.String(), Equals, "test.a.c1")

	cr := r.Clone()
	c.Assert(r.String(), Equals, cr.String())

	col1 := column.Col{
		ColumnInfo: model.ColumnInfo{
			FieldType: *types.NewFieldType(mysql.TypeLong),
			Name:      model.NewCIStr("c2"),
		},
	}
	col1.Flag |= mysql.UnsignedFlag

	r1 := &field.ResultField{
		Col:          col1,
		Name:         "c2",
		TableName:    "a",
		OrgTableName: "t1",
		DBName:       "test",
	}

	rs := []*field.ResultField{r, r1}
	ns := field.RFQNames(rs)
	c.Assert(ns, HasLen, 2)
	c.Assert(ns[0], Equals, "\"c1\"")
	c.Assert(ns[1], Equals, "\"c2\"")

	col2 := column.Col{
		ColumnInfo: model.ColumnInfo{
			FieldType: *types.NewFieldType(mysql.TypeVarchar),
			Name:      model.NewCIStr("c3"),
		},
	}
	col2.Flag |= mysql.UnsignedFlag
	col3 := column.Col{
		ColumnInfo: model.ColumnInfo{
			FieldType: *types.NewFieldType(mysql.TypeBlob),
			Name:      model.NewCIStr("c4"),
		},
	}
	col3.Flag |= mysql.UnsignedFlag

	cols := []*column.Col{&col, &col1, &col2, &col3}
	rs = field.ColsToResultFields(cols, "t")
	c.Assert(rs, HasLen, 4)
	c.Assert(rs[2].Tp, Equals, mysql.TypeVarString)
	c.Assert(rs[3].Tp, Equals, mysql.TypeBlob)

	col4 := column.Col{
		ColumnInfo: model.ColumnInfo{
			FieldType: *types.NewFieldType(mysql.TypeVarchar),
			Name:      model.NewCIStr("c2"),
		},
	}
	r2 := &field.ResultField{
		Col:          col4,
		Name:         "c22",
		TableName:    "b",
		OrgTableName: "t2",
		DBName:       "test",
	}
	rs = []*field.ResultField{r, r1, r2}

	// For CloneFieldByName
	_, err := field.CloneFieldByName("cx", rs)
	c.Assert(err, NotNil)
	_, err = field.CloneFieldByName("c2", rs)
	c.Assert(err, IsNil)

	// For ContainAllFieldNames
	names := []string{"cx", "c2"}
	b := field.ContainAllFieldNames(names, rs)
	c.Assert(b, IsFalse)
	names = []string{"c2", "c1"}
	b = field.ContainAllFieldNames(names, rs)
	c.Assert(b, IsTrue)
}
开发者ID:lovedboy,项目名称:tidb,代码行数:96,代码来源:result_field_test.go



注:本文中的github.com/pingcap/tidb/field.RFQNames函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang field.ResultField类代码示例发布时间:2022-05-28
下一篇:
Golang field.GetResultFieldIndex函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap