本文整理匯總了Golang中github.com/lann/builder.Extend函數的典型用法代碼示例。如果您正苦於以下問題:Golang Extend函數的具體用法?Golang Extend怎麽用?Golang Extend使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Extend函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Columns
// Columns adds result columns to the query.
func (b SelectBuilder) Columns(columns ...string) SelectBuilder {
var parts []interface{}
for _, str := range columns {
parts = append(parts, newPart(str))
}
return builder.Extend(b, "Columns", parts).(SelectBuilder)
}
示例2: TestExtendNil
func TestExtendNil(t *testing.T) {
b := builder.Extend(FooBuilder, "Add", nil)
_, ok := builder.Get(b, "X")
if ok {
t.Fatalf("key %v set unexpectedly", "Add")
}
}
示例3: TestExtendPanic
func TestExtendPanic(t *testing.T) {
var panicVal *reflect.ValueError
func() {
defer func() { panicVal = recover().(*reflect.ValueError) }()
builder.Extend(FooBuilder, "Add", Foo{})
}()
if panicVal == nil {
t.Errorf("expected panic, didn't")
}
}
示例4: Columns
// Columns adds insert columns to the query.
func (b InsertBuilder) Columns(columns ...string) InsertBuilder {
return builder.Extend(b, "Columns", columns).(InsertBuilder)
}
示例5: Options
// Options adds keyword options before the INTO clause of the query.
func (b InsertBuilder) Options(options ...string) InsertBuilder {
return builder.Extend(b, "Options", options).(InsertBuilder)
}
示例6: OrderBy
// OrderBy adds ORDER BY expressions to the query.
func (b UpdateBuilder) OrderBy(orderBys ...string) UpdateBuilder {
return builder.Extend(b, "OrderBys", orderBys).(UpdateBuilder)
}
示例7: OrderBy
// OrderBy adds ORDER BY expressions to the query.
func (b DeleteBuilder) OrderBy(orderBys ...string) DeleteBuilder {
return builder.Extend(b, "OrderBys", orderBys).(DeleteBuilder)
}
示例8: OrderBy
// OrderBy adds ORDER BY expressions to the query.
func (b SelectBuilder) OrderBy(orderBys ...string) SelectBuilder {
return builder.Extend(b, "OrderBys", orderBys).(SelectBuilder)
}
示例9: GroupBy
// GroupBy adds GROUP BY expressions to the query.
func (b SelectBuilder) GroupBy(groupBys ...string) SelectBuilder {
return builder.Extend(b, "GroupBys", groupBys).(SelectBuilder)
}
示例10: Options
// Options adds select option to the query
func (b SelectBuilder) Options(options ...string) SelectBuilder {
return builder.Extend(b, "Options", options).(SelectBuilder)
}
示例11: Having
// Having adds an expression to the HAVING clause of the query.
//
// See Where.
func (b SelectBuilder) Having(pred interface{}, rest ...interface{}) SelectBuilder {
return builder.Extend(b, "HavingParts", newWhereParts(pred, rest...)).(SelectBuilder)
}
示例12: Where
// Where adds an expression to the WHERE clause of the query.
//
// Expressions are ANDed together in the generated SQL.
//
// Where accepts several types for its pred argument:
//
// nil OR "" - ignored.
//
// string - SQL expression.
// If the expression has SQL placeholders then a set of arguments must be passed
// as well, one for each placeholder.
//
// map[string]interface{} OR Eq - map of SQL expressions to values. Each key is
// transformed into an expression like "<key> = ?", with the corresponding value
// bound to the placeholder. If the value is nil, the expression will be "<key>
// IS NULL". If the value is an array or slice, the expression will be "<key> IN
// (?,?,...)", with one placeholder for each item in the value. These expressions
// are ANDed together.
//
// Where will panic if pred isn't any of the above types.
func (b SelectBuilder) Where(pred interface{}, args ...interface{}) SelectBuilder {
return builder.Extend(b, "WhereParts", newWhereParts(pred, args...)).(SelectBuilder)
}
示例13: Columns
// Columns adds result columns to the query.
func (b SelectBuilder) Columns(columns ...string) SelectBuilder {
return builder.Extend(b, "Columns", columns).(SelectBuilder)
}