xorm/internal/utils/builder.go
Lunny Xiao f9a6990ecb
All checks were successful
continuous-integration/drone/push Build is passing
Refactor orderby and support arguments (#2150)
Reviewed-on: #2150
2022-05-31 11:00:28 +08:00

28 lines
552 B
Go

// Copyright 2022 The Xorm Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package utils
import (
"fmt"
"xorm.io/builder"
)
type BuildReader interface {
String() string
Args() []interface{}
}
// WriteBuilder writes writers to one
func WriteBuilder(w *builder.BytesWriter, inputs ...BuildReader) error {
for _, input := range inputs {
if _, err := fmt.Fprint(w, input.String()); err != nil {
return err
}
w.Append(input.Args()...)
}
return nil
}