diff --git a/builq.go b/builq.go index b7bf0e8..8cd5ecc 100644 --- a/builq.go +++ b/builq.go @@ -41,6 +41,14 @@ type OnelineBuilder struct { // BuildFn represents [Builder.Addf]. Just for the easier BuilderFunc declaration. type BuildFn func(format constString, args ...any) *Builder +func (q BuildFn) Build() (query string, args []any, err error) { + return q("").Build() +} + +func (q BuildFn) DebugBuild() string { + return q("").DebugBuild() +} + func New() BuildFn { var b Builder return b.Addf @@ -51,14 +59,6 @@ func NewOneline() BuildFn { return b.Addf } -func Build(q BuildFn) (query string, args []any, err error) { - return q("").Build() -} - -func Debug(q BuildFn) string { - return q("").DebugBuild() -} - // Addf formats according to a format specifier, writes to query and appends args. // Format param must be a constant string. func (b *OnelineBuilder) Addf(format constString, args ...any) *Builder { diff --git a/example_test.go b/example_test.go index 5d170f5..84035f2 100644 --- a/example_test.go +++ b/example_test.go @@ -59,9 +59,9 @@ func ExampleNew() { q("SELECT this") q("FROM %$", "that") - query, _, err := builq.Build(q) + query, _, err := q.Build() panicIf(err) - debug := builq.Debug(q) + debug := q.DebugBuild() fmt.Print(query) fmt.Print(debug)