ソースを参照

add query.StringLine

Aneurin Barker Snook 1 年間 前
コミット
c9ce05f9d2
1 ファイル変更7 行追加0 行削除
  1. 7 0
      query.go

+ 7 - 0
query.go

@@ -77,10 +77,17 @@ func (query *Query) Copy() *Query {
 	return newQuery
 	return newQuery
 }
 }
 
 
+// String returns the query formatted across multiple lines.
 func (query *Query) String() string {
 func (query *Query) String() string {
 	return strings.Join(query.Lines, "\n")
 	return strings.Join(query.Lines, "\n")
 }
 }
 
 
+// StringLine returns the query formatted on a single line.
+// This reduces readability but may be more suitable for logging.
+func (query *Query) StringLine() string {
+	return strings.Join(query.Lines, " ")
+}
+
 // NewQuery creates a new, empty Query.
 // NewQuery creates a new, empty Query.
 func NewQuery() *Query {
 func NewQuery() *Query {
 	return &Query{
 	return &Query{