Skip to content

Commit

Permalink
sql #32: mv blocking.*.structList to .structs 'cause Lazily.structs()…
Browse files Browse the repository at this point in the history
… gives Iterator, not a list
  • Loading branch information
Miha-x64 committed Mar 14, 2020
1 parent f47a1ba commit 0299de6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -47,7 +47,7 @@ object Eagerly {
inline fun <CUR : AutoCloseable, SCH : Schema<SCH>> struct(table: Table<SCH, *, *>, bindBy: BindBy): Fetch<Blocking<CUR>, StructSnapshot<SCH>> =
FetchStructEagerly(table, bindBy)

inline fun <CUR : AutoCloseable, SCH : Schema<SCH>> structList(table: Table<SCH, *, *>, bindBy: BindBy): Fetch<Blocking<CUR>, List<StructSnapshot<SCH>>> =
inline fun <CUR : AutoCloseable, SCH : Schema<SCH>> structs(table: Table<SCH, *, *>, bindBy: BindBy): Fetch<Blocking<CUR>, List<StructSnapshot<SCH>>> =
FetchStructListEagerly(table, bindBy)
}

Expand All @@ -67,7 +67,7 @@ object Lazily {
inline fun <CUR : AutoCloseable, SCH : Schema<SCH>> struct(table: Table<SCH, *, *>, bindBy: BindBy): Fetch<Blocking<CUR>, Lazy<StructSnapshot<SCH>>> =
FetchStructLazily(table, bindBy)

inline fun <CUR : AutoCloseable, SCH : Schema<SCH>> structList(table: Table<SCH, *, *>, bindBy: BindBy): Fetch<Blocking<CUR>, CloseableIterator<TemporaryStruct<SCH>>> =
inline fun <CUR : AutoCloseable, SCH : Schema<SCH>> structs(table: Table<SCH, *, *>, bindBy: BindBy): Fetch<Blocking<CUR>, CloseableIterator<TemporaryStruct<SCH>>> =
FetchStructListLazily<CUR, SCH>(table, bindBy)

inline fun cellByteStream(): Fetch<Blocking<ResultSet>, InputStream> =
Expand Down
Expand Up @@ -101,7 +101,7 @@ open class TemplatesTest {

val userContacts = session.query(
USERS_BY_NAME_AND_EMAIL_START, string, string,
structList<CUR, Tuple<Struct<Tuple<String, DataType.Simple<String>, String, DataType.Simple<String>>>, Tuple<String, DataType.Simple<String>, String, DataType.Simple<String>>, Struct<Tuple<String, DataType.Simple<String>, Long, DataType.Simple<Long>>>, Tuple<String, DataType.Simple<String>, Long, DataType.Simple<Long>>>>(joined, BindBy.Name)
structs<CUR, Tuple<Struct<Tuple<String, DataType.Simple<String>, String, DataType.Simple<String>>>, Tuple<String, DataType.Simple<String>, String, DataType.Simple<String>>, Struct<Tuple<String, DataType.Simple<String>, Long, DataType.Simple<Long>>>, Tuple<String, DataType.Simple<String>, Long, DataType.Simple<Long>>>>(joined, BindBy.Name)
)
val contacts = userContacts("John", "john")
assertEquals(listOf(expectedJohn), contacts)
Expand All @@ -116,7 +116,7 @@ open class TemplatesTest {

val userContacts = session.query(
USERS_BY_NAME_AND_EMAIL_START, string, string,
structList<CUR, Tuple<Struct<Tuple<String, DataType.Simple<String>, String, DataType.Simple<String>>>, Tuple<String, DataType.Simple<String>, String, DataType.Simple<String>>, Struct<Tuple<String, DataType.Simple<String>, Long, DataType.Simple<Long>>>, Tuple<String, DataType.Simple<String>, Long, DataType.Simple<Long>>>>(joined, BindBy.Name)
structs<CUR, Tuple<Struct<Tuple<String, DataType.Simple<String>, String, DataType.Simple<String>>>, Tuple<String, DataType.Simple<String>, String, DataType.Simple<String>>, Struct<Tuple<String, DataType.Simple<String>, Long, DataType.Simple<Long>>>, Tuple<String, DataType.Simple<String>, Long, DataType.Simple<Long>>>>(joined, BindBy.Name)
)
val iter = userContacts("John", "john") // don't collect TemporaryStructs!
assertTrue(iter.hasNext())
Expand Down

0 comments on commit 0299de6

Please sign in to comment.