dttung2905 commented on code in PR #306: URL: https://github.com/apache/iceberg-go/pull/306#discussion_r1960326046
########## catalog/glue/glue.go: ########## @@ -155,33 +156,42 @@ func NewCatalog(opts ...Option) *Catalog { // ListTables returns a list of Iceberg tables in the given Glue database. // // The namespace should just contain the Glue database name. -func (c *Catalog) ListTables(ctx context.Context, namespace table.Identifier) ([]table.Identifier, error) { + +func (c *Catalog) ListTables(ctx context.Context, namespace table.Identifier) iter.Seq2[table.Identifier, error] { + return func(yield func(table.Identifier, error) bool) { + for { + tbls, nextPageToken, err := c.ListTablesPage(ctx, namespace) + if err != nil { + yield(table.Identifier{}, err) + return + } + for _, tbl := range tbls { + if !yield(tbl, nil) { + return + } + } + if nextPageToken == nil { + return + } + } + } +} + +func (c *Catalog) ListTablesPage(ctx context.Context, namespace table.Identifier) ([]table.Identifier, *string, error) { Review Comment: Thanks for the quick review. I really appreciate it. :pray: >Any particular reason to export this? No just typo on my side. It should be private method >Also I'm not seeing how the next page token is being passed back to it for it to be used? Cmiiw, from the current code, the `c.glueSvc.GetTables` does not use any next page token. Mainly I think it is meant for checking the end of the page in `ListTables` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org