lib/sqlite-store.js
function (args, done) {
      var q = _.clone(args.q)
      var qent = args.qent
      q.limit$ = 1
      var qs = schemastm(qent)

      self.connection.all(qs.text, function (err, results) {
        if (err) {
          return done(err)
        }
        var schema = {}
        results.forEach(function (row) {
          schema[row.name] = row.type.toLowerCase()
        })

        var query = selectstm(qent, q)

        self.connection.get(query.text, query.values, function (err, row) {
          if (err) {
            return done(err)
          }
          if (row) {
            var fent = makeent(qent, row, schema)
            seneca.log.debug('load', q, fent, desc)
            return done(null, fent)
          }
          return done(null, null)
        })
      })
    }
function (args, done) {
      var q = _.clone(args.q)
      var qent = args.qent
      q.limit$ = 1
      var qs = schemastm(qent)

      self.connection.all(qs.text, function (err, results) {
        if (err) {
          return done(err)
        }
        var schema = {}
        results.forEach(function (row) {
          schema[row.name] = row.type.toLowerCase()
        })

        var query = selectstm(qent, q)

        self.connection.get(query.text, query.values, function (err, row) {
          if (err) {
            return done(err)
          }
          if (row) {
            var fent = makeent(qent, row, schema)
            seneca.log.debug('load', q, fent, desc)
            return done(null, fent)
          }
          return done(null, null)
        })
      })
    }
function ( args , done ) { var q = _ . clone ( args . q ) var qent = args . qent q . limit$ = 1 var qs = schemastm ( qent ) self . connection . all ( qs . text , function ( err , results ) { if ( err ) { return done ( err ) } var schema = { } results . forEach ( function ( row ) { schema [ row . name ] = row . type . toLowerCase ( ) } ) var query = selectstm ( qent , q ) self . connection . get ( query . text , query . values , function ( err , row ) { if ( err ) { return done ( err ) } if ( row ) { var fent = makeent ( qent , row , schema ) seneca . log . debug ( 'load' , q , fent , desc ) return done ( null , fent ) } return done ( null , null ) } ) } ) }
load the first matching entity
load the first matching entity