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

Golang format.Formatter类代码示例

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

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



在下文中一共展示了Formatter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 plan.Plan Explain interface.
func (r *SelectLockPlan) Explain(w format.Formatter) {
	r.Src.Explain(w)
	if r.Lock != coldef.SelectLockForUpdate {
		// no need to lock, just return.
		return
	}
	w.Format("┌Lock row keys for update\n")
}
开发者ID:ninefive,项目名称:tidb,代码行数:9,代码来源:lock.go


示例4: Explain

// Explain implements the stmt.Statement Explain interface.
func (s *DeleteStmt) Explain(ctx context.Context, w format.Formatter) {
	p, err := s.plan(ctx)
	if err != nil {
		log.Error(err)
		return
	}
	p.Explain(w)
	w.Format("└Delete row\n")
}
开发者ID:Brian110,项目名称:tidb,代码行数:10,代码来源:delete.go


示例5: Explain

// Explain implements the stmt.Statement Explain interface.
func (s *SelectStmt) Explain(ctx context.Context, w format.Formatter) {
	p, err := s.Plan(ctx)
	if err != nil {
		w.Format("ERROR: %v\n", err)
		return
	}

	p.Explain(w)
}
开发者ID:nengwang,项目名称:tidb,代码行数:10,代码来源:select.go


示例6: 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


示例7: Explain

// Explain implements the stmt.Statement Explain interface.
func (s *UpdateStmt) Explain(ctx context.Context, w format.Formatter) {
	p, err := s.plan(ctx)
	if err != nil {
		log.Error(err)
		return
	}
	if p != nil {
		p.Explain(w)
	}
	w.Format("└Update fields %v\n", s.List)
}
开发者ID:Brian110,项目名称:tidb,代码行数:12,代码来源:update.go


示例8: Explain

// Explain implements the stmt.Statement Explain interface.
func (s *DeleteStmt) Explain(ctx context.Context, w format.Formatter) {
	p, err := s.indexPlan(ctx)
	if err != nil {
		log.Error(err)
		return
	}
	if p != nil {
		p.Explain(w)
	} else {
		w.Format("┌Iterate all rows of table: %s\n", s.TableIdent)
	}
	w.Format("└Delete row\n")
}
开发者ID:szctop,项目名称:tidb,代码行数:14,代码来源:delete.go


示例9: 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


示例10: 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


示例11: 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


示例12: 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


示例13: Explain

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


示例14: 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


示例15: Explain

// Explain implements the stmt.Statement Explain interface.
func (s *CreateUserStmt) Explain(ctx context.Context, w format.Formatter) {
	w.Format("%s\n", s.Text)
}
开发者ID:remotesyssupport,项目名称:tidb,代码行数:4,代码来源:account_manage.go


示例16: Explain

// Explain implements the plan.Plan Explain interface.
func (r *DistinctDefaultPlan) Explain(w format.Formatter) {
	r.Src.Explain(w)
	w.Format("┌Compute distinct rows\n└Output field names %v\n", r.ResultFields)
}
开发者ID:no2key,项目名称:tidb,代码行数:5,代码来源:distinct.go


示例17: Explain

// Explain implements plan.Plan Explain interface.
func (r *HavingPlan) Explain(w format.Formatter) {
	r.Src.Explain(w)
	w.Format("┌Having %s\n└Output field names %v\n", r.Expr.String(), r.Src.GetFields())
}
开发者ID:superwood,项目名称:tidb,代码行数:5,代码来源:having.go


示例18: Explain

// Explain implements plan.Plan Explain interface.
func (r *selectIndexDefaultPlan) Explain(w format.Formatter) {
	w.Format("┌Iterate all values of index %q\n└Output field names N/A\n", r.nm)
}
开发者ID:szctop,项目名称:tidb,代码行数:4,代码来源:plans.go


示例19: Explain

// Explain implements the stmt.Statement Explain interface.
func (s *DeallocateStmt) Explain(ctx context.Context, w format.Formatter) {
	w.Format("%s\n", s.Text)
}
开发者ID:ninefive,项目名称:tidb,代码行数:4,代码来源:prepared.go


示例20: Explain

// Explain implements the stmt.Statement Explain interface.
func (s *ShowStmt) Explain(ctx context.Context, w format.Formatter) {
	w.Format("%s\n", s.Text)
}
开发者ID:ninefive,项目名称:tidb,代码行数:4,代码来源:show.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang hack.Slice函数代码示例发布时间:2022-05-28
下一篇:
Golang errors2.ErrorNotEqual函数代码示例发布时间: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