當前位置: 首頁>>代碼示例>>Golang>>正文


Golang builder.Set函數代碼示例

本文整理匯總了Golang中github.com/lann/builder.Set函數的典型用法代碼示例。如果您正苦於以下問題:Golang Set函數的具體用法?Golang Set怎麽用?Golang Set使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Set函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的github.com/lann/builder.Set函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。