Skip to content

Commit

Permalink
Merge pull request #25 from go-jet/develop
Browse files Browse the repository at this point in the history
Merge develop to master.
  • Loading branch information
go-jet authored Oct 18, 2019
2 parents 02fafd8 + 64a51dc commit 940fc06
Show file tree
Hide file tree
Showing 15 changed files with 927 additions and 673 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
- run: mkdir -p $TEST_RESULTS
- run: go test -v ./... -coverpkg=github.com/go-jet/jet/postgres/...,github.com/go-jet/jet/mysql/...,github.com/go-jet/jet/execution/...,github.com/go-jet/jet/generator/...,github.com/go-jet/jet/internal/... -coverprofile=cover.out 2>&1 | go-junit-report > $TEST_RESULTS/results.xml
- run: go test -v ./... -coverpkg=github.com/go-jet/jet/postgres/...,github.com/go-jet/jet/mysql/...,github.com/go-jet/jet/qrm/...,github.com/go-jet/jet/generator/...,github.com/go-jet/jet/internal/... -coverprofile=cover.out 2>&1 | go-junit-report > $TEST_RESULTS/results.xml

- run:
name: Upload code coverage
Expand Down
6 changes: 4 additions & 2 deletions internal/jet/statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ type Statement interface {
DebugSql() (query string)

// Query executes statement over database connection db and stores row result in destination.
// Destination can be arbitrary structure
// Destination can be either pointer to struct or pointer to a slice.
// If destination is pointer to struct and query result set is empty, method returns qrm.ErrNoRows.
Query(db qrm.DB, destination interface{}) error
// QueryContext executes statement with a context over database connection db and stores row result in destination.
// Destination can be of arbitrary structure
// Destination can be either pointer to struct or pointer to a slice.
// If destination is pointer to struct and query result set is empty, method returns qrm.ErrNoRows.
QueryContext(context context.Context, db qrm.DB, destination interface{}) error

//Exec executes statement over db connection without returning any rows.
Expand Down
8 changes: 8 additions & 0 deletions internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ func IsNil(v interface{}) bool {
return v == nil || (reflect.ValueOf(v).Kind() == reflect.Ptr && reflect.ValueOf(v).IsNil())
}

// MustBeTrue panics when condition is false
func MustBeTrue(condition bool, errorStr string) {
if !condition {
panic(errorStr)
}
}

// MustBe panics with errorStr error, if v interface is not of reflect kind
func MustBe(v interface{}, kind reflect.Kind, errorStr string) {
if reflect.TypeOf(v).Kind() != kind {
Expand Down Expand Up @@ -165,6 +172,7 @@ func ErrorCatch(err *error) {
}
}

// StringSliceContains checks if slice of strings contains a string
func StringSliceContains(strings []string, contains string) bool {
for _, str := range strings {
if str == contains {
Expand Down
2 changes: 1 addition & 1 deletion postgres/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var COUNT = jet.COUNT
// EVERY is aggregate function. Returns true if all input values are true, otherwise false
var EVERY = jet.EVERY

// MAXf is aggregate function. Returns maximum value of expression across all input values
// MAX is aggregate function. Returns maximum value of expression across all input values
var MAX = jet.MAX

// MAXf is aggregate function. Returns maximum value of float expression across all input values
Expand Down
Loading

0 comments on commit 940fc06

Please sign in to comment.