GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - scientifichackers/sql2code: Convert SQL to import-able code!

BranchesTags
Open more actions menu

Latest commit

 

History

2 Commits
2 Commits

Folders and files

NameName
Last commit message
Last commit date
example
example
 
 
sql2code
sql2code
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
pyproject.toml
pyproject.toml
 
 

Repository files navigation

SQL 2 code

This project lets you write functions in SQL and import them in code.

Currently, it only supports dart.

$ pip install sql2code
-- queries1.sql
listMessages(sender, limit, offset) {
    SELECT *
      FROM message
     WHERE sender = $sender  
  ORDER BY sentAt
     LIMIT $limit OFFSET $offset;
}
$ sql2dart quries.sql queries.dart 
// queries.dart
import 'package:sqflite/sqflite.dart';

Future<List<Map<String, dynamic>>> listMessages(
  Database db,
  sender,
  limit,
  offset,
) async {
  return await db.transaction((txn) async {
    return await txn.rawQuery(
      """SELECT * FROM message WHERE sender =  ? ORDER BY sentAt LIMIT ? OFFSET ? """,
      [sender, limit, offset],
    );
  });
}

About

Convert SQL to import-able code!

Resources

Readme
MIT license
Activity
Custom properties

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.