GithubHelp home page GithubHelp logo

5m1ly / seaql Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 4.0 568 KB

Optimize your fxserver data traffic with SeaQL's dynamic sql wrapper and data cacher

License: GNU General Public License v3.0

Lua 100.00%
cache-storage fivem fxserver library redm wrapper

seaql's Introduction

About

With this resource you can use the normal sql syntax, however an extra keyword has been added that must be at the beginning of your query, this is 'SYNC' or 'ASYNC'. based on the given keyword and your underlying sql library, it will then automatically execute the query and return the results synchronously or asynchronously.

Supported Libraries

Here you will find all the sql libraries this wrapper supports

Example

-- simply call the SeaQL table
SeaQL(
    -- pass a query to the call
    -- NOTE: it needs to start with 'SYNC' or 'ASYNC'
    'SYNC INSERT INTO testing_table (t_int, t_str, t_json) VALUES (?, ?, ?)',
    -- pass the params like you would with oxmysql
    {
        1,
        '2',
        { name = 1, pos = 2 } -- table params get auto json encoded
    },
    -- add a callback to catch the result
    function(result)
        print('callback')
    end
)

--[[
    when fetching data do the same thing but add a 4th param
    the 4th param is to tell if you want to cache the data
    for example when you fetch user data set it to false
    but when you fetch a list of vehicles set it to true
	when you fetch a list of license plates set it to true
]]
SeaQL('SYNC SELECT t_json FROM testing_table WHERE t_int = ?', { 1 }, function(result)
    print('callback')
end, true)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.