/**
 * from https://github.com/koajs/generic-session/blob/master/example/app.js
 */ 

var session = require('koa-generic-session');
var SQLiteStore = require('..');
var koa = require('koa');

var app = koa();
app.keys = ['keys', 'keykeys'];
app.use(session({
  store: new SQLiteStore('sqlite.db')
}));

app.use(function *() {
  switch (this.path) {
  case '/get':
    get.call(this);
    break;
  case '/remove':
    remove.call(this);
    break;
  case '/regenerate':
    yield regenerate.call(this);
    break;
  }
});

function get() {
  var session = this.session;
  session.count = session.count || 0;
  session.count++;
  this.body = session.count;
}

function remove() {
  this.session = null;
  this.body = 0;
}

function *regenerate() {
  get.call(this);
  yield this.regenerateSession();
  get.call(this);
}

app.listen(8080);
@@ -79,19 +79,21 @@
 s%0A */ %0A%0A
-var
+const
  session
@@ -127,19 +127,21 @@
 sion');%0A
-var
+const
  SQLiteS
@@ -166,13 +166,15 @@
 ');%0A
-var k
+const K
 oa =
@@ -195,19 +195,25 @@
 );%0A%0A
-var
+const
  app = 
-k
+new K
 oa()
@@ -320,20 +320,22 @@
 use(
-function *()
+async (ctx) =%3E
  %7B%0A 
@@ -343,20 +343,19 @@
 switch (
-this
+ctx
 .path) %7B
@@ -373,34 +373,28 @@
 et':%0A    get
-.call(this
+(ctx
 );%0A    break
@@ -423,26 +423,20 @@
   remove
-.call(this
+(ctx
 );%0A    b
@@ -467,21 +467,21 @@
 e':%0A    
-yield
+await
  regener
@@ -483,26 +483,20 @@
 generate
-.call(this
+(ctx
 );%0A    b
@@ -527,17 +527,24 @@
 get(
+ctx
 ) %7B%0A  
-var
+const %7B
  ses
@@ -552,23 +552,15 @@
 ion 
-= this.session;
+%7D = ctx
 %0A  s
@@ -611,28 +611,27 @@
 .count++;%0A  
-this
+ctx
 .body = sess
@@ -664,18 +664,20 @@
 ove(
+ctx
 ) %7B%0A  
-this
+ctx
 .ses
@@ -691,20 +691,19 @@
 null;%0A  
-this
+ctx
 .body = 
@@ -704,24 +704,30 @@
 ody = 0;%0A%7D%0A%0A
+async 
 function *re
@@ -723,17 +723,16 @@
 unction 
-*
 regenera
@@ -734,16 +734,19 @@
 enerate(
+ctx
 ) %7B%0A  ge
@@ -750,33 +750,26 @@
  get
-.call(this);%0A  yield this
+(ctx);%0A  await ctx
 .reg
@@ -795,18 +795,12 @@
  get
-.call(this
+(ctx
 );%0A%7D

update example