(Feat): Initial Commit
This commit is contained in:
39
internal/util/db/where_in_test.go
Normal file
39
internal/util/db/where_in_test.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package db_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"allaboutapps.dev/aw/go-starter/internal/models"
|
||||
"allaboutapps.dev/aw/go-starter/internal/test"
|
||||
"allaboutapps.dev/aw/go-starter/internal/util/db"
|
||||
"github.com/aarondl/sqlboiler/v4/queries"
|
||||
"github.com/aarondl/sqlboiler/v4/queries/qm"
|
||||
)
|
||||
|
||||
func TestWhereIn(t *testing.T) {
|
||||
query := models.NewQuery(
|
||||
qm.Select("*"),
|
||||
qm.From("users"),
|
||||
db.InnerJoin("users", "id", "app_user_profiles", "user_id"),
|
||||
db.WhereIn("app_user_profiles", "username", []string{"max", "muster", "peter"}),
|
||||
)
|
||||
|
||||
sql, args := queries.BuildQuery(query)
|
||||
|
||||
test.Snapshoter.Label("SQL").Save(t, sql)
|
||||
test.Snapshoter.Label("Args").Save(t, args...)
|
||||
}
|
||||
|
||||
func TestNIN(t *testing.T) {
|
||||
query := models.NewQuery(
|
||||
qm.Select("*"),
|
||||
qm.From("users"),
|
||||
db.InnerJoin("users", "id", "app_user_profiles", "user_id"),
|
||||
db.NIN("app_user_profiles.username", []string{"max", "muster", "peter"}),
|
||||
)
|
||||
|
||||
sql, args := queries.BuildQuery(query)
|
||||
|
||||
test.Snapshoter.Label("SQL").Save(t, sql)
|
||||
test.Snapshoter.Label("Args").Save(t, args...)
|
||||
}
|
||||
Reference in New Issue
Block a user