All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jaskell.sql.Using Maven / Gradle / Ivy

Go to download

This is a utils library for java 8 project. It include parsec combinators and sql generators library.

There is a newer version: 2.9.2
Show newest version
package jaskell.sql;

import jaskell.script.Directive;
import jaskell.script.Parameter;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class Using implements Directive {
    Directive _prefix;
    List _items;
    Using(String names){
        this._items = Arrays.stream(names.split(","))
                .map(String::trim).map(Name::new).collect(Collectors.toList());;
    }

    Using(String ... names){
        this._items = Arrays.stream(names).map(Name::new).collect(Collectors.toList());
    }

    Using(Directive... names){
        this._items = Arrays.asList(names);
    }

    public Where where(Predicate predicate){
        Where re = new Where(predicate);
        re._from = this;
        return re;
    }

    @Override
    public String script() {
        return String.format("%s USING(%s)",
                _prefix.script(),
                _items.stream().map(Directive::script).collect(Collectors.joining(",")));
    }

    @Override
    public List> parameters() {
        return null;
    }

    public static class Where extends Query {
        Directive _from;
        Predicate _predicate;

        Where(Predicate predicate){

        }
        @Override
        public String script() {
            return null;
        }

        @Override
        public List> parameters() {
            return null;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy