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

Golang builder.Set函数代码示例

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

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



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

示例1: Between

func (rb ruleBuilder) Between(min interface{}, max interface{}) ruleBuilder {
	if reflect.TypeOf(min).Kind() != reflect.TypeOf(max).Kind() {
		panic("Disparate values passed into Between(...) \n" +
			"\nMin: " + reflect.TypeOf(min).Kind().String() +
			"\nMax: " + reflect.TypeOf(max).Kind().String())
	}
	rb = rb.updateTypeAccordingTo(min)
	builder.Set(rb, "Min", min)
	builder.Set(rb, "Max", max)

	return rb
}
开发者ID:joslinm,项目名称:validate,代码行数:12,代码来源:rule_builder.go


示例2: SetMap

// SetMap set columns and values for insert builder from a map of column name and value
// note that it will reset all previous columns and values was set if any
func (b InsertBuilder) SetMap(clauses map[string]interface{}) InsertBuilder {
	cols := make([]string, 0, len(clauses))
	vals := make([]interface{}, 0, len(clauses))
	for col, val := range clauses {
		cols = append(cols, col)
		vals = append(vals, val)
	}

	b = builder.Set(b, "Columns", cols).(InsertBuilder)
	b = builder.Set(b, "Values", [][]interface{}{vals}).(InsertBuilder)
	return b
}
开发者ID:zenododobird,项目名称:horizon,代码行数:14,代码来源:insert.go


示例3: Set

//############################################################################
func (p beamerBuilder) Set(key string, value interface{}) beamerBuilder {
	m, ok := builder.Get(p, "KVStore")

	if ok {
		store := m.(map[string]interface{})
		store[key] = value
		return builder.Set(p, "KVStore", store).(beamerBuilder)
	}

	store := make(map[string]interface{})
	store[key] = value
	return builder.Set(p, "KVStore", store).(beamerBuilder)

}
开发者ID:denkhaus,项目名称:beamer,代码行数:15,代码来源:beamer.go


示例4: AddHrefLink

func (b jsonBuilder) AddHrefLink(class string, href string) jsonBuilder {
	val, _ := builder.Get(b, "Hal")
	if val == nil {
		val = Hal{}
	}
	hal, _ := val.(Hal)
	hal.AddHrefLink(class, href)
	return builder.Set(b, "Hal", hal).(jsonBuilder)
}
开发者ID:scotwells,项目名称:go-desk,代码行数:9,代码来源:json_builder.go


示例5: AddCustomField

func (b jsonBuilder) AddCustomField(name string, value interface{}) jsonBuilder {
	val, _ := builder.Get(b, "CustomFields")
	if val == nil {
		val = make(map[string]interface{})
	}
	fields, _ := val.(map[string]interface{})
	fields[name] = value
	return builder.Set(b, "CustomFields", fields).(jsonBuilder)
}
开发者ID:scotwells,项目名称:go-desk,代码行数:9,代码来源:json_builder.go


示例6: S3Destination

func (b ContainerBuilder) S3Destination(identifier string, destination *S3Destination) ContainerBuilder {
	if destination.Key == "" {
		destination.Key = identifier + "-" + randString(10)
	}
	if destination.Bucket == "" {
		panic("You need to set S3Destination.Bucket")
	}
	return builder.Set(b, "S3Destination", destination).(ContainerBuilder)
}
开发者ID:VictorBjelkholm,项目名称:goblitline,代码行数:9,代码来源:container.go


示例7: setRunWith

func setRunWith(b interface{}, baseRunner BaseRunner) interface{} {
	var runner Runner
	switch r := baseRunner.(type) {
	case Runner:
		runner = r
	case *sql.DB:
		runner = &dbRunner{r}
	}
	return builder.Set(b, "RunWith", runner)
}
开发者ID:nancyandrews,项目名称:MobileMainStreet,代码行数:10,代码来源:squirrel.go


示例8: TestSetInvalidNil

func TestSetInvalidNil(t *testing.T) {
	var panicVal interface{}
	func() {
		defer func() { panicVal = recover() }()
		b := builder.Set(FooBuilder, "X", nil)
		builder.GetStruct(b)
	}()
	if panicVal == nil {
		t.Errorf("expected panic, didn't")
	}
}
开发者ID:zenododobird,项目名称:horizon,代码行数:11,代码来源:builder_test.go


示例9: Params

func (b FunctionBuilder) Params(key string, value interface{}) FunctionBuilder {
	var hash map[string]interface{}
	params, ok := builder.Get(b, "Params")
	if ok {
		hash = params.(map[string]interface{})
	} else {
		hash = make(map[string]interface{})
	}
	hash[key] = value
	return builder.Set(b, "Params", hash).(FunctionBuilder)
}
开发者ID:Typeform,项目名称:goblitline,代码行数:11,代码来源:function.go


示例10: Query

func (b searchReqBuilder) Query(v string) searchReqBuilder {
	return builder.Set(b, "Query", v).(searchReqBuilder)
}
开发者ID:fun-alex-alex2006hw,项目名称:stk,代码行数:3,代码来源:builders.go


示例11: SiteID

func (b answersReqBuilder) SiteID(v string) answersReqBuilder {
	return builder.Set(b, "SiteID", v).(answersReqBuilder)
}
开发者ID:fun-alex-alex2006hw,项目名称:stk,代码行数:3,代码来源:builders.go


示例12: Tags

func (b searchReqBuilder) Tags(tags []string) searchReqBuilder {
	return builder.Set(b, "Tags", tags).(searchReqBuilder)
}
开发者ID:fun-alex-alex2006hw,项目名称:stk,代码行数:3,代码来源:builders.go


示例13: X

func (b fooBuilder) X(i int) fooBuilder {
	return builder.Set(b, "X", i).(fooBuilder)
}
开发者ID:zenododobird,项目名称:horizon,代码行数:3,代码来源:builder_test.go


示例14: Into

// Into sets the INTO clause of the query.
func (b InsertBuilder) Into(from string) InsertBuilder {
	return builder.Set(b, "Into", from).(InsertBuilder)
}
开发者ID:zenododobird,项目名称:horizon,代码行数:4,代码来源:insert.go


示例15: Multiplier

func (b simpleExprBuilder) Multiplier(i int) simpleExprBuilder {
	return builder.Set(b, "Multiplier", i).(simpleExprBuilder)
}
开发者ID:zenododobird,项目名称:horizon,代码行数:3,代码来源:example_test.go


示例16: Save

func (b FunctionBuilder) Save(c ContainerBuilder) FunctionBuilder {
	cont := c.build()
	return builder.Set(b, "Container", &cont).(FunctionBuilder)
}
开发者ID:Typeform,项目名称:goblitline,代码行数:4,代码来源:function.go


示例17: Limit

// Limit sets a LIMIT clause on the query.
func (b UpdateBuilder) Limit(limit uint64) UpdateBuilder {
	return builder.Set(b, "Limit", fmt.Sprintf("%d", limit)).(UpdateBuilder)
}
开发者ID:nancyandrews,项目名称:MobileMainStreet,代码行数:4,代码来源:update.go


示例18: Table

// Table sets the table to be updated.
func (b UpdateBuilder) Table(table string) UpdateBuilder {
	return builder.Set(b, "Table", table).(UpdateBuilder)
}
开发者ID:nancyandrews,项目名称:MobileMainStreet,代码行数:4,代码来源:update.go


示例19: PlaceholderFormat

// PlaceholderFormat sets PlaceholderFormat (e.g. Question or Dollar) for the
// query.
func (b UpdateBuilder) PlaceholderFormat(f PlaceholderFormat) UpdateBuilder {
	return builder.Set(b, "PlaceholderFormat", f).(UpdateBuilder)
}
开发者ID:nancyandrews,项目名称:MobileMainStreet,代码行数:5,代码来源:update.go


示例20: I

func (b fooBuilder) I(i interface{}) fooBuilder {
	return builder.Set(b, "I", i).(fooBuilder)
}
开发者ID:zenododobird,项目名称:horizon,代码行数:3,代码来源:builder_test.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang squirrel.Select函数代码示例发布时间:2022-05-23
下一篇:
Golang builder.Register函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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