contrib/tnitter: replace `latest_posts` by a 2 args `list_posts`
[nit.git] / contrib / tnitter / src / database.nit
index 4c88b51..b38fa9b 100644 (file)
@@ -79,10 +79,10 @@ class DB
                end
        end
 
-       # Get the latest tnits
-       fun latest_posts(count: Int): Array[Post]
+       # List `count` of the latest Tnits skipping `offset`
+       fun list_posts(offset, count: Int): Array[Post]
        do
-               var stmt = select("user, text FROM posts ORDER BY datetime(posted) DESC LIMIT {count}")
+               var stmt = select("user, text FROM posts ORDER BY datetime(posted) DESC LIMIT {count} OFFSET {offset}")
                assert stmt != null else print error or else "?"
 
                var posts = new Array[Post]