Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
module github.com/elgris/sqrl
module github.com/parsyl/sqrl

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.2.2
)

go 1.13
10 changes: 10 additions & 0 deletions insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,16 @@ func (b *InsertBuilder) SetMap(clauses map[string]interface{}) *InsertBuilder {
return b
}

// AppendColumn adds a new column to the insert query. NOTE: you problaby
// don't want to use this for muti-row inserts.
func (b *InsertBuilder) AppendColumn(name string, value interface{}) *InsertBuilder {
b.columns = append(b.columns, name)
for i, vals := range b.values {
b.values[i] = append(vals, value)
}
return b
}

// Select set Select clause for insert query
// If Values and Select are used, then Select has higher priority
func (b *InsertBuilder) Select(sb *SelectBuilder) *InsertBuilder {
Expand Down
2 changes: 1 addition & 1 deletion pg/array.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strconv"
"strings"

"github.com/elgris/sqrl"
"github.com/parsyl/sqrl"
)

// Array converts value into Postgres Array
Expand Down
4 changes: 2 additions & 2 deletions pg/array_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"testing"

"github.com/elgris/sqrl"
"github.com/elgris/sqrl/pg"
"github.com/parsyl/sqrl"
"github.com/parsyl/sqrl/pg"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pg/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"

"github.com/elgris/sqrl"
"github.com/parsyl/sqrl"
)

// JSONB converts value into Postgres JSONB
Expand Down
4 changes: 2 additions & 2 deletions pg/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"testing"

"github.com/elgris/sqrl"
"github.com/elgris/sqrl/pg"
"github.com/parsyl/sqrl"
"github.com/parsyl/sqrl/pg"
"github.com/stretchr/testify/assert"
)

Expand Down
8 changes: 7 additions & 1 deletion select.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ func (b *SelectBuilder) Columns(columns ...string) *SelectBuilder {
// Column adds a result column to the query.
// Unlike Columns, Column accepts args which will be bound to placeholders in
// the columns string, for example:
// Column("IF(col IN ("+Placeholders(3)+"), 1, 0) as col", 1, 2, 3)
//
// Column("IF(col IN ("+Placeholders(3)+"), 1, 0) as col", 1, 2, 3)
func (b *SelectBuilder) Column(column interface{}, args ...interface{}) *SelectBuilder {
b.columns = append(b.columns, newPart(column, args...))

Expand Down Expand Up @@ -271,6 +272,11 @@ func (b *SelectBuilder) RightJoin(join string, rest ...interface{}) *SelectBuild
return b.JoinClause("RIGHT JOIN "+join, rest...)
}

// CrossJoin adds a CROSS JOIN clause to the query.
func (b *SelectBuilder) CrossJoin(join string, rest ...interface{}) *SelectBuilder {
return b.JoinClause("CROSS JOIN "+join, rest...)
}

// Where adds an expression to the WHERE clause of the query.
//
// Expressions are ANDed together in the generated SQL.
Expand Down