Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for partial query with nullable #128

Merged
merged 2 commits into from
Apr 26, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
clickhouse:
strategy:
matrix:
dbversion: ['yandex/clickhouse-server']
dbversion: ['clickhouse/clickhouse-server']
go: ['1.19', '1.20']
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
Expand Down
8 changes: 8 additions & 0 deletions create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ func TestCreate(t *testing.T) {
}

tests.AssertEqual(t, result, user)

type partialUser struct {
Name string
}
var partialResult partialUser
if err := DB.Raw("select * from users where id = ?", user.ID).Scan(&partialResult).Error; err != nil {
t.Fatalf("failed to query partial, got error %v", err)
}
}

func TestBatchCreate(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions migrator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type User struct {
Name string
FirstName string
LastName string
Age int64
Age int64 `gorm:"type:Nullable(Int64)"`
Active bool
Salary float32
CreatedAt time.Time
Expand Down Expand Up @@ -111,9 +111,9 @@ func TestMigrator_DontSupportEmptyDefaultValue(t *testing.T) {
if err != nil {
t.Fatalf("Can not parse dsn, got error %v", err)
}

DB, err := gorm.Open(clickhouse.New(clickhouse.Config{
Conn: clickhousego.OpenDB(options),
Conn: clickhousego.OpenDB(options),
DontSupportEmptyDefaultValue: true,
}))
if err != nil {
Expand Down
Loading