Mock with postgres

This commit is contained in:
Eden Kirin
2024-06-23 18:35:52 +02:00
parent 13fe2222dd
commit 0fda3f6ef6
3 changed files with 45 additions and 52 deletions

View File

@ -7,7 +7,7 @@ import (
"github.com/DATA-DOG/go-sqlmock" "github.com/DATA-DOG/go-sqlmock"
"github.com/go-playground/assert" "github.com/go-playground/assert"
"gorm.io/driver/mysql" "gorm.io/driver/postgres"
"gorm.io/gorm" "gorm.io/gorm"
) )
@ -17,9 +17,8 @@ func NewMockDB() (*gorm.DB, sqlmock.Sqlmock) {
log.Fatalf("An error '%s' was not expected when opening a stub database connection", err) log.Fatalf("An error '%s' was not expected when opening a stub database connection", err)
} }
gormDB, err := gorm.Open(mysql.New(mysql.Config{ gormDB, err := gorm.Open(postgres.New(postgres.Config{
Conn: db, Conn: db,
SkipInitializeWithVersion: true,
}), &gorm.Config{}) }), &gorm.Config{})
if err != nil { if err != nil {
@ -71,7 +70,7 @@ func TestHandleOperatorEQ(t *testing.T) {
boolValue: &boolTrue, boolValue: &boolTrue,
valueKind: reflect.Bool, valueKind: reflect.Bool,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field = true ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field = true ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorEQ bool false", name: "handleOperatorEQ bool false",
@ -80,7 +79,7 @@ func TestHandleOperatorEQ(t *testing.T) {
boolValue: &boolFalse, boolValue: &boolFalse,
valueKind: reflect.Bool, valueKind: reflect.Bool,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field = false ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field = false ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorEQ int64", name: "handleOperatorEQ int64",
@ -89,7 +88,7 @@ func TestHandleOperatorEQ(t *testing.T) {
intValue: &int64Value, intValue: &int64Value,
valueKind: reflect.Int64, valueKind: reflect.Int64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field = -123456 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field = -123456 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorEQ uint64", name: "handleOperatorEQ uint64",
@ -98,7 +97,7 @@ func TestHandleOperatorEQ(t *testing.T) {
uintValue: &uint64Value, uintValue: &uint64Value,
valueKind: reflect.Uint64, valueKind: reflect.Uint64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field = 123456 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field = 123456 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorEQ float", name: "handleOperatorEQ float",
@ -107,7 +106,7 @@ func TestHandleOperatorEQ(t *testing.T) {
floatValue: &floatValue, floatValue: &floatValue,
valueKind: reflect.Float64, valueKind: reflect.Float64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field = -123456.789 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field = -123456.789 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorEQ string", name: "handleOperatorEQ string",
@ -116,7 +115,7 @@ func TestHandleOperatorEQ(t *testing.T) {
strValue: &strValue, strValue: &strValue,
valueKind: reflect.String, valueKind: reflect.String,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field = 'Some Value' ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field = 'Some Value' ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
} }
@ -144,7 +143,7 @@ func TestHandleOperatorNE(t *testing.T) {
boolValue: &boolTrue, boolValue: &boolTrue,
valueKind: reflect.Bool, valueKind: reflect.Bool,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field != true ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field != true ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorNE bool false", name: "handleOperatorNE bool false",
@ -153,7 +152,7 @@ func TestHandleOperatorNE(t *testing.T) {
boolValue: &boolFalse, boolValue: &boolFalse,
valueKind: reflect.Bool, valueKind: reflect.Bool,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field != false ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field != false ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorNE int64", name: "handleOperatorNE int64",
@ -162,7 +161,7 @@ func TestHandleOperatorNE(t *testing.T) {
intValue: &int64Value, intValue: &int64Value,
valueKind: reflect.Int64, valueKind: reflect.Int64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field != -123456 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field != -123456 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorNE uint64", name: "handleOperatorNE uint64",
@ -171,7 +170,7 @@ func TestHandleOperatorNE(t *testing.T) {
uintValue: &uint64Value, uintValue: &uint64Value,
valueKind: reflect.Uint64, valueKind: reflect.Uint64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field != 123456 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field != 123456 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorNE float", name: "handleOperatorNE float",
@ -180,7 +179,7 @@ func TestHandleOperatorNE(t *testing.T) {
floatValue: &floatValue, floatValue: &floatValue,
valueKind: reflect.Float64, valueKind: reflect.Float64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field != -123456.789 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field != -123456.789 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorNE string", name: "handleOperatorNE string",
@ -189,7 +188,7 @@ func TestHandleOperatorNE(t *testing.T) {
strValue: &strValue, strValue: &strValue,
valueKind: reflect.String, valueKind: reflect.String,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field != 'Some Value' ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field != 'Some Value' ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
} }
@ -217,7 +216,7 @@ func TestHandleOperatorLIKE(t *testing.T) {
strValue: &strValue, strValue: &strValue,
valueKind: reflect.String, valueKind: reflect.String,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field LIKE '%Some Value%' ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field LIKE '%Some Value%' ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
} }
@ -245,7 +244,7 @@ func TestHandleOperatorILIKE(t *testing.T) {
strValue: &strValue, strValue: &strValue,
valueKind: reflect.String, valueKind: reflect.String,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field ILIKE '%Some Value%' ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field ILIKE '%Some Value%' ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
} }
@ -273,7 +272,7 @@ func TestHandleOperatorGT(t *testing.T) {
intValue: &int64Value, intValue: &int64Value,
valueKind: reflect.Int64, valueKind: reflect.Int64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field > -123456 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field > -123456 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorGT uint64", name: "handleOperatorGT uint64",
@ -282,7 +281,7 @@ func TestHandleOperatorGT(t *testing.T) {
uintValue: &uint64Value, uintValue: &uint64Value,
valueKind: reflect.Uint64, valueKind: reflect.Uint64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field > 123456 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field > 123456 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorGT float", name: "handleOperatorGT float",
@ -291,7 +290,7 @@ func TestHandleOperatorGT(t *testing.T) {
floatValue: &floatValue, floatValue: &floatValue,
valueKind: reflect.Float64, valueKind: reflect.Float64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field > -123456.789 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field > -123456.789 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorGT string", name: "handleOperatorGT string",
@ -300,7 +299,7 @@ func TestHandleOperatorGT(t *testing.T) {
strValue: &strValue, strValue: &strValue,
valueKind: reflect.String, valueKind: reflect.String,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field > 'Some Value' ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field > 'Some Value' ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
} }
@ -328,7 +327,7 @@ func TestHandleOperatorGE(t *testing.T) {
intValue: &int64Value, intValue: &int64Value,
valueKind: reflect.Int64, valueKind: reflect.Int64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field >= -123456 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field >= -123456 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorGE uint64", name: "handleOperatorGE uint64",
@ -337,7 +336,7 @@ func TestHandleOperatorGE(t *testing.T) {
uintValue: &uint64Value, uintValue: &uint64Value,
valueKind: reflect.Uint64, valueKind: reflect.Uint64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field >= 123456 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field >= 123456 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorGE float", name: "handleOperatorGE float",
@ -346,7 +345,7 @@ func TestHandleOperatorGE(t *testing.T) {
floatValue: &floatValue, floatValue: &floatValue,
valueKind: reflect.Float64, valueKind: reflect.Float64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field >= -123456.789 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field >= -123456.789 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorGE string", name: "handleOperatorGE string",
@ -355,7 +354,7 @@ func TestHandleOperatorGE(t *testing.T) {
strValue: &strValue, strValue: &strValue,
valueKind: reflect.String, valueKind: reflect.String,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field >= 'Some Value' ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field >= 'Some Value' ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
} }
@ -383,7 +382,7 @@ func TestHandleOperatorLT(t *testing.T) {
intValue: &int64Value, intValue: &int64Value,
valueKind: reflect.Int64, valueKind: reflect.Int64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field < -123456 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field < -123456 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorLT uint64", name: "handleOperatorLT uint64",
@ -392,7 +391,7 @@ func TestHandleOperatorLT(t *testing.T) {
uintValue: &uint64Value, uintValue: &uint64Value,
valueKind: reflect.Uint64, valueKind: reflect.Uint64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field < 123456 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field < 123456 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorLT float", name: "handleOperatorLT float",
@ -401,7 +400,7 @@ func TestHandleOperatorLT(t *testing.T) {
floatValue: &floatValue, floatValue: &floatValue,
valueKind: reflect.Float64, valueKind: reflect.Float64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field < -123456.789 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field < -123456.789 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorLT string", name: "handleOperatorLT string",
@ -410,7 +409,7 @@ func TestHandleOperatorLT(t *testing.T) {
strValue: &strValue, strValue: &strValue,
valueKind: reflect.String, valueKind: reflect.String,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field < 'Some Value' ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field < 'Some Value' ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
} }
@ -438,7 +437,7 @@ func TestHandleOperatorLE(t *testing.T) {
intValue: &int64Value, intValue: &int64Value,
valueKind: reflect.Int64, valueKind: reflect.Int64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field <= -123456 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field <= -123456 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorLE uint64", name: "handleOperatorLE uint64",
@ -447,7 +446,7 @@ func TestHandleOperatorLE(t *testing.T) {
uintValue: &uint64Value, uintValue: &uint64Value,
valueKind: reflect.Uint64, valueKind: reflect.Uint64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field <= 123456 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field <= 123456 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorLE float", name: "handleOperatorLE float",
@ -456,7 +455,7 @@ func TestHandleOperatorLE(t *testing.T) {
floatValue: &floatValue, floatValue: &floatValue,
valueKind: reflect.Float64, valueKind: reflect.Float64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field <= -123456.789 ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field <= -123456.789 ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorLE string", name: "handleOperatorLE string",
@ -465,7 +464,7 @@ func TestHandleOperatorLE(t *testing.T) {
strValue: &strValue, strValue: &strValue,
valueKind: reflect.String, valueKind: reflect.String,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field <= 'Some Value' ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field <= 'Some Value' ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
} }
@ -493,7 +492,7 @@ func TestHandleOperatorIN(t *testing.T) {
boolValues: &boolValues, boolValues: &boolValues,
valueKind: reflect.Bool, valueKind: reflect.Bool,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field IN (true,false) ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field IN (true,false) ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorIN int64", name: "handleOperatorIN int64",
@ -502,7 +501,7 @@ func TestHandleOperatorIN(t *testing.T) {
intValues: &int64Values, intValues: &int64Values,
valueKind: reflect.Int64, valueKind: reflect.Int64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field IN (-123456,1,123456) ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field IN (-123456,1,123456) ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorIN uint64", name: "handleOperatorIN uint64",
@ -511,7 +510,7 @@ func TestHandleOperatorIN(t *testing.T) {
uintValues: &uint64Values, uintValues: &uint64Values,
valueKind: reflect.Uint64, valueKind: reflect.Uint64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field IN (123456,1234567,1234568) ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field IN (123456,1234567,1234568) ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorIN float", name: "handleOperatorIN float",
@ -520,7 +519,7 @@ func TestHandleOperatorIN(t *testing.T) {
floatValues: &floatValues, floatValues: &floatValues,
valueKind: reflect.Float64, valueKind: reflect.Float64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field IN (-123456.789,-1,123456.789) ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field IN (-123456.789,-1,123456.789) ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorIN string", name: "handleOperatorIN string",
@ -529,7 +528,7 @@ func TestHandleOperatorIN(t *testing.T) {
strValues: &strValues, strValues: &strValues,
valueKind: reflect.String, valueKind: reflect.String,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field IN ('First Value','Second Value','Third Value') ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field IN ('First Value','Second Value','Third Value') ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
} }
@ -557,7 +556,7 @@ func TestHandleOperatorNOT_IN(t *testing.T) {
boolValues: &boolValues, boolValues: &boolValues,
valueKind: reflect.Bool, valueKind: reflect.Bool,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field NOT IN (true,false) ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field NOT IN (true,false) ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorNOT_IN int64", name: "handleOperatorNOT_IN int64",
@ -566,7 +565,7 @@ func TestHandleOperatorNOT_IN(t *testing.T) {
intValues: &int64Values, intValues: &int64Values,
valueKind: reflect.Int64, valueKind: reflect.Int64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field NOT IN (-123456,1,123456) ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field NOT IN (-123456,1,123456) ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorNOT_IN uint64", name: "handleOperatorNOT_IN uint64",
@ -575,7 +574,7 @@ func TestHandleOperatorNOT_IN(t *testing.T) {
uintValues: &uint64Values, uintValues: &uint64Values,
valueKind: reflect.Uint64, valueKind: reflect.Uint64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field NOT IN (123456,1234567,1234568) ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field NOT IN (123456,1234567,1234568) ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorNOT_IN float", name: "handleOperatorNOT_IN float",
@ -584,7 +583,7 @@ func TestHandleOperatorNOT_IN(t *testing.T) {
floatValues: &floatValues, floatValues: &floatValues,
valueKind: reflect.Float64, valueKind: reflect.Float64,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field NOT IN (-123456.789,-1,123456.789) ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field NOT IN (-123456.789,-1,123456.789) ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
{ {
name: "handleOperatorNOT_IN string", name: "handleOperatorNOT_IN string",
@ -593,7 +592,7 @@ func TestHandleOperatorNOT_IN(t *testing.T) {
strValues: &strValues, strValues: &strValues,
valueKind: reflect.String, valueKind: reflect.String,
}, },
expected: "SELECT * FROM `my_models` WHERE my_table.my_field NOT IN ('First Value','Second Value','Third Value') ORDER BY `my_models`.`id` LIMIT 1", expected: "SELECT * FROM \"my_models\" WHERE my_table.my_field NOT IN ('First Value','Second Value','Third Value') ORDER BY \"my_models\".\"id\" LIMIT 1",
}, },
} }

4
go.mod
View File

@ -3,6 +3,8 @@ module repo-pattern
go 1.22.3 go 1.22.3
require ( require (
github.com/DATA-DOG/go-sqlmock v1.5.2
github.com/go-playground/assert v1.2.1
github.com/google/uuid v1.6.0 github.com/google/uuid v1.6.0
github.com/kelseyhightower/envconfig v1.4.0 github.com/kelseyhightower/envconfig v1.4.0
github.com/mozillazg/go-slugify v0.2.0 github.com/mozillazg/go-slugify v0.2.0
@ -16,9 +18,7 @@ require (
require ( require (
filippo.io/edwards25519 v1.1.0 // indirect filippo.io/edwards25519 v1.1.0 // indirect
github.com/DATA-DOG/go-sqlmock v1.5.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-playground/assert v1.2.1 // indirect
github.com/go-sql-driver/mysql v1.8.1 // indirect github.com/go-sql-driver/mysql v1.8.1 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect

6
go.sum
View File

@ -48,14 +48,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=