Add missing query source file
This commit is contained in:
parent
df3a171b0d
commit
07ccce6512
1 changed files with 34 additions and 0 deletions
34
query.go
Normal file
34
query.go
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
//"github.com/stephenafamo/bob"
|
||||
//"github.com/stephenafamo/bob/dialect/psql"
|
||||
)
|
||||
|
||||
type QueryWriter interface {
|
||||
WriteQuery(ctx context.Context, w io.Writer, start int) ([]any, error)
|
||||
}
|
||||
|
||||
func queryToString(query QueryWriter) string {
|
||||
buf := new(bytes.Buffer)
|
||||
_, err := query.WriteQuery(context.TODO(), buf, 0)
|
||||
if err != nil {
|
||||
return fmt.Sprintf("Failed to write query to buffer: %v", err)
|
||||
}
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
/*
|
||||
func insertQueryToString(query bob.BaseQuery[*dialect.InsertQuery]) string {
|
||||
buf := new(bytes.Buffer)
|
||||
_, err := query.WriteQuery(context.TODO(), buf, 0)
|
||||
if err != nil {
|
||||
return fmt.Sprintf("Failed to write query: %v", err)
|
||||
}
|
||||
return buf.String()
|
||||
}
|
||||
*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue