Skip to content

Commit

Permalink
Default number of rows for COPY methods.
Browse files Browse the repository at this point in the history
Most of the time it's not important
  • Loading branch information
oyvindberg committed May 1, 2024
1 parent b18291d commit 4958d13
Show file tree
Hide file tree
Showing 717 changed files with 1,377 additions and 1,377 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ trait PersonRepo {
def deleteById(compositeId: PersonId)(implicit c: Connection): Boolean
def insert(unsaved: PersonRow)(implicit c: Connection): PersonRow
def insert(unsaved: PersonRowUnsaved)(implicit c: Connection): PersonRow
def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int)(implicit c: Connection): Long
def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int = 10000)(implicit c: Connection): Long
/* NOTE: this functionality requires PostgreSQL 16 or later! */
def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int)(implicit c: Connection): Long
def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int = 10000)(implicit c: Connection): Long
def select: SelectBuilder[PersonFields, PersonRow]
def selectAll(implicit c: Connection): List[PersonRow]
def selectByFieldValues(fieldValues: List[PersonFieldOrIdValue[?]])(implicit c: Connection): List[PersonRow]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ class PersonRepoImpl extends PersonRepo {
}

}
override def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int)(implicit c: Connection): Long = {
override def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int = 10000)(implicit c: Connection): Long = {
streamingInsert(s"""COPY compositepk.person("one", "two", "name") FROM STDIN""", batchSize, unsaved)(PersonRow.text, c)
}
/* NOTE: this functionality requires PostgreSQL 16 or later! */
override def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int)(implicit c: Connection): Long = {
override def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int = 10000)(implicit c: Connection): Long = {
streamingInsert(s"""COPY compositepk.person("name", "one", "two") FROM STDIN (DEFAULT '__DEFAULT_VALUE__')""", batchSize, unsaved)(PersonRowUnsaved.text, c)
}
override def select: SelectBuilder[PersonFields, PersonRow] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ class PersonRepoMock(toRow: Function1[PersonRowUnsaved, PersonRow],
override def insert(unsaved: PersonRowUnsaved)(implicit c: Connection): PersonRow = {
insert(toRow(unsaved))
}
override def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int)(implicit c: Connection): Long = {
override def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int = 10000)(implicit c: Connection): Long = {
unsaved.foreach { row =>
map += (row.compositeId -> row)
}
unsaved.size.toLong
}
/* NOTE: this functionality requires PostgreSQL 16 or later! */
override def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int)(implicit c: Connection): Long = {
override def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int = 10000)(implicit c: Connection): Long = {
unsaved.foreach { unsavedRow =>
val row = toRow(unsavedRow)
map += (row.compositeId -> row)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trait FootballClubRepo {
def deleteById(id: FootballClubId)(implicit c: Connection): Boolean
def deleteByIds(ids: Array[FootballClubId])(implicit c: Connection): Int
def insert(unsaved: FootballClubRow)(implicit c: Connection): FootballClubRow
def insertStreaming(unsaved: Iterator[FootballClubRow], batchSize: Int)(implicit c: Connection): Long
def insertStreaming(unsaved: Iterator[FootballClubRow], batchSize: Int = 10000)(implicit c: Connection): Long
def select: SelectBuilder[FootballClubFields, FootballClubRow]
def selectAll(implicit c: Connection): List[FootballClubRow]
def selectByFieldValues(fieldValues: List[FootballClubFieldOrIdValue[?]])(implicit c: Connection): List[FootballClubRow]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class FootballClubRepoImpl extends FootballClubRepo {
.executeInsert(FootballClubRow.rowParser(1).single)

}
override def insertStreaming(unsaved: Iterator[FootballClubRow], batchSize: Int)(implicit c: Connection): Long = {
override def insertStreaming(unsaved: Iterator[FootballClubRow], batchSize: Int = 10000)(implicit c: Connection): Long = {
streamingInsert(s"""COPY myschema.football_club("id", "name") FROM STDIN""", batchSize, unsaved)(FootballClubRow.text, c)
}
override def select: SelectBuilder[FootballClubFields, FootballClubRow] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class FootballClubRepoMock(map: scala.collection.mutable.Map[FootballClubId, Foo

unsaved
}
override def insertStreaming(unsaved: Iterator[FootballClubRow], batchSize: Int)(implicit c: Connection): Long = {
override def insertStreaming(unsaved: Iterator[FootballClubRow], batchSize: Int = 10000)(implicit c: Connection): Long = {
unsaved.foreach { row =>
map += (row.id -> row)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trait MaritalStatusRepo {
def deleteById(id: MaritalStatusId)(implicit c: Connection): Boolean
def deleteByIds(ids: Array[MaritalStatusId])(implicit c: Connection): Int
def insert(unsaved: MaritalStatusRow)(implicit c: Connection): MaritalStatusRow
def insertStreaming(unsaved: Iterator[MaritalStatusRow], batchSize: Int)(implicit c: Connection): Long
def insertStreaming(unsaved: Iterator[MaritalStatusRow], batchSize: Int = 10000)(implicit c: Connection): Long
def select: SelectBuilder[MaritalStatusFields, MaritalStatusRow]
def selectAll(implicit c: Connection): List[MaritalStatusRow]
def selectByFieldValues(fieldValues: List[MaritalStatusFieldOrIdValue[?]])(implicit c: Connection): List[MaritalStatusRow]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class MaritalStatusRepoImpl extends MaritalStatusRepo {
.executeInsert(MaritalStatusRow.rowParser(1).single)

}
override def insertStreaming(unsaved: Iterator[MaritalStatusRow], batchSize: Int)(implicit c: Connection): Long = {
override def insertStreaming(unsaved: Iterator[MaritalStatusRow], batchSize: Int = 10000)(implicit c: Connection): Long = {
streamingInsert(s"""COPY myschema.marital_status("id") FROM STDIN""", batchSize, unsaved)(MaritalStatusRow.text, c)
}
override def select: SelectBuilder[MaritalStatusFields, MaritalStatusRow] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class MaritalStatusRepoMock(map: scala.collection.mutable.Map[MaritalStatusId, M

unsaved
}
override def insertStreaming(unsaved: Iterator[MaritalStatusRow], batchSize: Int)(implicit c: Connection): Long = {
override def insertStreaming(unsaved: Iterator[MaritalStatusRow], batchSize: Int = 10000)(implicit c: Connection): Long = {
unsaved.foreach { row =>
map += (row.id -> row)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ trait PersonRepo {
def deleteByIds(ids: Array[PersonId])(implicit c: Connection): Int
def insert(unsaved: PersonRow)(implicit c: Connection): PersonRow
def insert(unsaved: PersonRowUnsaved)(implicit c: Connection): PersonRow
def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int)(implicit c: Connection): Long
def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int = 10000)(implicit c: Connection): Long
/* NOTE: this functionality requires PostgreSQL 16 or later! */
def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int)(implicit c: Connection): Long
def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int = 10000)(implicit c: Connection): Long
def select: SelectBuilder[PersonFields, PersonRow]
def selectAll(implicit c: Connection): List[PersonRow]
def selectByFieldValues(fieldValues: List[PersonFieldOrIdValue[?]])(implicit c: Connection): List[PersonRow]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ class PersonRepoImpl extends PersonRepo {
}

}
override def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int)(implicit c: Connection): Long = {
override def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int = 10000)(implicit c: Connection): Long = {
streamingInsert(s"""COPY myschema.person("id", "favourite_football_club_id", "name", "nick_name", "blog_url", "email", "phone", "likes_pizza", "marital_status_id", "work_email", "sector", "favorite_number") FROM STDIN""", batchSize, unsaved)(PersonRow.text, c)
}
/* NOTE: this functionality requires PostgreSQL 16 or later! */
override def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int)(implicit c: Connection): Long = {
override def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int = 10000)(implicit c: Connection): Long = {
streamingInsert(s"""COPY myschema.person("favourite_football_club_id", "name", "nick_name", "blog_url", "email", "phone", "likes_pizza", "work_email", "id", "marital_status_id", "sector", "favorite_number") FROM STDIN (DEFAULT '__DEFAULT_VALUE__')""", batchSize, unsaved)(PersonRowUnsaved.text, c)
}
override def select: SelectBuilder[PersonFields, PersonRow] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ class PersonRepoMock(toRow: Function1[PersonRowUnsaved, PersonRow],
override def insert(unsaved: PersonRowUnsaved)(implicit c: Connection): PersonRow = {
insert(toRow(unsaved))
}
override def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int)(implicit c: Connection): Long = {
override def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int = 10000)(implicit c: Connection): Long = {
unsaved.foreach { row =>
map += (row.id -> row)
}
unsaved.size.toLong
}
/* NOTE: this functionality requires PostgreSQL 16 or later! */
override def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int)(implicit c: Connection): Long = {
override def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int = 10000)(implicit c: Connection): Long = {
unsaved.foreach { unsavedRow =>
val row = toRow(unsavedRow)
map += (row.id -> row)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ trait PersonRepo {
def deleteById(compositeId: PersonId)(implicit c: Connection): Boolean
def insert(unsaved: PersonRow)(implicit c: Connection): PersonRow
def insert(unsaved: PersonRowUnsaved)(implicit c: Connection): PersonRow
def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int)(implicit c: Connection): Long
def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int = 10000)(implicit c: Connection): Long
/* NOTE: this functionality requires PostgreSQL 16 or later! */
def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int)(implicit c: Connection): Long
def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int = 10000)(implicit c: Connection): Long
def select: SelectBuilder[PersonFields, PersonRow]
def selectAll(implicit c: Connection): List[PersonRow]
def selectByFieldValues(fieldValues: List[PersonFieldOrIdValue[?]])(implicit c: Connection): List[PersonRow]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ class PersonRepoImpl extends PersonRepo {
}

}
override def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int)(implicit c: Connection): Long = {
override def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int = 10000)(implicit c: Connection): Long = {
streamingInsert(s"""COPY compositepk.person("one", "two", "name") FROM STDIN""", batchSize, unsaved)(PersonRow.text, c)
}
/* NOTE: this functionality requires PostgreSQL 16 or later! */
override def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int)(implicit c: Connection): Long = {
override def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int = 10000)(implicit c: Connection): Long = {
streamingInsert(s"""COPY compositepk.person("name", "one", "two") FROM STDIN (DEFAULT '__DEFAULT_VALUE__')""", batchSize, unsaved)(PersonRowUnsaved.text, c)
}
override def select: SelectBuilder[PersonFields, PersonRow] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ class PersonRepoMock(toRow: Function1[PersonRowUnsaved, PersonRow],
override def insert(unsaved: PersonRowUnsaved)(implicit c: Connection): PersonRow = {
insert(toRow(unsaved))
}
override def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int)(implicit c: Connection): Long = {
override def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int = 10000)(implicit c: Connection): Long = {
unsaved.foreach { row =>
map += (row.compositeId -> row)
}
unsaved.size.toLong
}
/* NOTE: this functionality requires PostgreSQL 16 or later! */
override def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int)(implicit c: Connection): Long = {
override def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int = 10000)(implicit c: Connection): Long = {
unsaved.foreach { unsavedRow =>
val row = toRow(unsavedRow)
map += (row.compositeId -> row)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trait FootballClubRepo {
def deleteById(id: FootballClubId)(implicit c: Connection): Boolean
def deleteByIds(ids: Array[FootballClubId])(implicit c: Connection): Int
def insert(unsaved: FootballClubRow)(implicit c: Connection): FootballClubRow
def insertStreaming(unsaved: Iterator[FootballClubRow], batchSize: Int)(implicit c: Connection): Long
def insertStreaming(unsaved: Iterator[FootballClubRow], batchSize: Int = 10000)(implicit c: Connection): Long
def select: SelectBuilder[FootballClubFields, FootballClubRow]
def selectAll(implicit c: Connection): List[FootballClubRow]
def selectByFieldValues(fieldValues: List[FootballClubFieldOrIdValue[?]])(implicit c: Connection): List[FootballClubRow]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class FootballClubRepoImpl extends FootballClubRepo {
.executeInsert(FootballClubRow.rowParser(1).single)

}
override def insertStreaming(unsaved: Iterator[FootballClubRow], batchSize: Int)(implicit c: Connection): Long = {
override def insertStreaming(unsaved: Iterator[FootballClubRow], batchSize: Int = 10000)(implicit c: Connection): Long = {
streamingInsert(s"""COPY myschema.football_club("id", "name") FROM STDIN""", batchSize, unsaved)(FootballClubRow.text, c)
}
override def select: SelectBuilder[FootballClubFields, FootballClubRow] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class FootballClubRepoMock(map: scala.collection.mutable.Map[FootballClubId, Foo

unsaved
}
override def insertStreaming(unsaved: Iterator[FootballClubRow], batchSize: Int)(implicit c: Connection): Long = {
override def insertStreaming(unsaved: Iterator[FootballClubRow], batchSize: Int = 10000)(implicit c: Connection): Long = {
unsaved.foreach { row =>
map += (row.id -> row)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trait MaritalStatusRepo {
def deleteById(id: MaritalStatusId)(implicit c: Connection): Boolean
def deleteByIds(ids: Array[MaritalStatusId])(implicit c: Connection): Int
def insert(unsaved: MaritalStatusRow)(implicit c: Connection): MaritalStatusRow
def insertStreaming(unsaved: Iterator[MaritalStatusRow], batchSize: Int)(implicit c: Connection): Long
def insertStreaming(unsaved: Iterator[MaritalStatusRow], batchSize: Int = 10000)(implicit c: Connection): Long
def select: SelectBuilder[MaritalStatusFields, MaritalStatusRow]
def selectAll(implicit c: Connection): List[MaritalStatusRow]
def selectByFieldValues(fieldValues: List[MaritalStatusFieldOrIdValue[?]])(implicit c: Connection): List[MaritalStatusRow]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class MaritalStatusRepoImpl extends MaritalStatusRepo {
.executeInsert(MaritalStatusRow.rowParser(1).single)

}
override def insertStreaming(unsaved: Iterator[MaritalStatusRow], batchSize: Int)(implicit c: Connection): Long = {
override def insertStreaming(unsaved: Iterator[MaritalStatusRow], batchSize: Int = 10000)(implicit c: Connection): Long = {
streamingInsert(s"""COPY myschema.marital_status("id") FROM STDIN""", batchSize, unsaved)(MaritalStatusRow.text, c)
}
override def select: SelectBuilder[MaritalStatusFields, MaritalStatusRow] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class MaritalStatusRepoMock(map: scala.collection.mutable.Map[MaritalStatusId, M

unsaved
}
override def insertStreaming(unsaved: Iterator[MaritalStatusRow], batchSize: Int)(implicit c: Connection): Long = {
override def insertStreaming(unsaved: Iterator[MaritalStatusRow], batchSize: Int = 10000)(implicit c: Connection): Long = {
unsaved.foreach { row =>
map += (row.id -> row)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ trait PersonRepo {
def deleteByIds(ids: Array[PersonId])(implicit c: Connection): Int
def insert(unsaved: PersonRow)(implicit c: Connection): PersonRow
def insert(unsaved: PersonRowUnsaved)(implicit c: Connection): PersonRow
def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int)(implicit c: Connection): Long
def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int = 10000)(implicit c: Connection): Long
/* NOTE: this functionality requires PostgreSQL 16 or later! */
def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int)(implicit c: Connection): Long
def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int = 10000)(implicit c: Connection): Long
def select: SelectBuilder[PersonFields, PersonRow]
def selectAll(implicit c: Connection): List[PersonRow]
def selectByFieldValues(fieldValues: List[PersonFieldOrIdValue[?]])(implicit c: Connection): List[PersonRow]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ class PersonRepoImpl extends PersonRepo {
}

}
override def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int)(implicit c: Connection): Long = {
override def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int = 10000)(implicit c: Connection): Long = {
streamingInsert(s"""COPY myschema.person("id", "favourite_football_club_id", "name", "nick_name", "blog_url", "email", "phone", "likes_pizza", "marital_status_id", "work_email", "sector", "favorite_number") FROM STDIN""", batchSize, unsaved)(PersonRow.text, c)
}
/* NOTE: this functionality requires PostgreSQL 16 or later! */
override def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int)(implicit c: Connection): Long = {
override def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int = 10000)(implicit c: Connection): Long = {
streamingInsert(s"""COPY myschema.person("favourite_football_club_id", "name", "nick_name", "blog_url", "email", "phone", "likes_pizza", "work_email", "id", "marital_status_id", "sector", "favorite_number") FROM STDIN (DEFAULT '__DEFAULT_VALUE__')""", batchSize, unsaved)(PersonRowUnsaved.text, c)
}
override def select: SelectBuilder[PersonFields, PersonRow] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ class PersonRepoMock(toRow: Function1[PersonRowUnsaved, PersonRow],
override def insert(unsaved: PersonRowUnsaved)(implicit c: Connection): PersonRow = {
insert(toRow(unsaved))
}
override def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int)(implicit c: Connection): Long = {
override def insertStreaming(unsaved: Iterator[PersonRow], batchSize: Int = 10000)(implicit c: Connection): Long = {
unsaved.foreach { row =>
map += (row.id -> row)
}
unsaved.size.toLong
}
/* NOTE: this functionality requires PostgreSQL 16 or later! */
override def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int)(implicit c: Connection): Long = {
override def insertUnsavedStreaming(unsaved: Iterator[PersonRowUnsaved], batchSize: Int = 10000)(implicit c: Connection): Long = {
unsaved.foreach { unsavedRow =>
val row = toRow(unsavedRow)
map += (row.id -> row)
Expand Down
Loading

0 comments on commit 4958d13

Please sign in to comment.