lua-resty-query

pgmoon 的便捷包装器

$ opm get xiangnanscu/lua-resty-query

lua-resty-query

pgmoon 的便捷包装器

安装

    opm get xiangnanscu/lua-resty-query

要求

概述

    local Query = require"resty.query"
    
    -- config your database and get a query function
    local query = Query {
      HOST = 'localhost',
      PORT = 5432,
      USER = 'postgres',
      PASSWORD = 'XXXXXX',
      DATABASE = 'test',
      CONNECT_TIMEOUT = 10000, -- 10 seconds
      MAX_IDLE_TIMEOUT = 10000,-- 10 seconds
      POOL = nil,
      POOL_SIZE = 50,
      SSL = false,
      SSL_VERIFY = nil,
      SSL_REQUIRED = nil,
      DEBUG = true,
    }
    -- now use this function in your controllers
    local res, err = query('select * from usr')
    if res == nil then
      return err
    end

作者

Nan Xiang(@xiangnanscu)

许可证

mit

依赖

版本