Giter Site home page Giter Site logo

sroca3 / scrawl Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 122 KB

(mirror repo) Scrawl is a sql builder for Microsoft's SQL server

Home Page: https://gitlab.com/sroca3/scrawl

License: Apache License 2.0

Java 99.49% TSQL 0.51%
sqlserver sql-server sqlbuilder jdbc sql sql-builder sql-query

scrawl's Introduction

coverage pipeline

Scrawl

Scrawl is a sql builder for Microsoft SQL Server or at least will start out that way.

Definition

Scrawl - to write (something) in a hurried, careless way.

While hopefully not indicative of the code quality, Scrawl’s name comes from it being a side project that I’m throwing together in my spare time. Also, it’s a cool sounding word.

Origin

Other fuller sql builder implementations already exist such as jOOQ and QueryDsl, but some of my personal experiences pushed me to write my own.

For jOOQ, I didn’t care for the paywall since to adopt such a library you might have to get through the first hurdle of convincing someone else to buy it.

For QueryDsl, I didn’t care for the code generation stance. I much prefer generate once then maintain vs always generate.

Additionally, for both mentioned libraries and more generally with respect to databases, I think trying to generate a common library is a hindrance. SQL languages have to all adhere to a standard first before we can get to that point. Thus, the sql building libraries should be language specific.

Finally, I’ve had too many experiences where an ORM or a sql building library gets in my way, so I wanted to build something thin. Sql building libraries should be like syntactic sugar. If the library gets in the way of generating specific sql statements, then I might as well just use a String.

Dependency Information

Maven

<dependency>
  <groupId>io.github.sroca3</groupId>
  <artifactId>scrawl</artifactId>
  <version>0.2.0</version>
</dependency>

Gradle

implementation 'io.github.sroca3:scrawl:0.2.0'

Usage

Validation Query

// SELECT 1
selectOne().getSql();

Select Queries

// SELECT * FROM Table
select(star()).from("Table").getSql();

The next examples assume you have a class CityTable.

City c = CITY.as("c");
// SELECT c.Name FROM City c
select(c.columns()).from(c).getSql();
var query = select(star()).from(CITY).where(CITY.name().eq("Atlanta"))
// SELECT * FROM City WHERE Name = :name
query.getSql();
// Parameter map: "name" : "Atlanta"
query.getParameterMap();

For other examples, see QueryTest.

scrawl's People

Contributors

sroca3 avatar

Stargazers

 avatar

Watchers

 avatar

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.