Coder Social home page Coder Social logo

wonray / dynamicquery Goto Github PK

View Code? Open in Web Editor NEW

This project forked from directxman12/dynamicquery

0.0 2.0 0.0 616 KB

A Java library which attempts to reproduce ActiveRecord/Arel coding style in Java (with javac hackery and more)

Java 96.44% Perl 3.56%

dynamicquery's Introduction

Some Notes

See the tests in DynamicQueryTests for examples and a sample ant build script for a Table definition (note: you must use Oracle/Sun Java 6 (possibly 7, haven’t tested) to process Table definitions, although for other files any Java 6+-compliant compiler will do)

Brief Example

assume we have an instance of the users table, User u, (see the tests in the test project for an example of how to get an instance; subject to becoming easier), as well as an instance of the apps table, App a.

// Query is initialized here, but not run
// this query is equivalent to
// "select [all columns, not actually *] from users join apps on apps.id = users.id"
DynamicQuery q = u.join(a).on(a.id().eq(u.id())).project();

// since DynamicQuery implements Collection<ITable>, you can loop
// through results, which aren't run until you actually go to do the loop
for (ITable it : q) System.out.println( ((User)it).getApps()[0].getName() );

dynamicquery's People

Contributors

directxman12 avatar

Watchers

 avatar  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.