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

org.disl.meta.SqlOperators.groovy Maven / Gradle / Ivy

Go to download

disl = data integration specific language. Goal of this project is to implement groovy based domain specific language supporting modelling of data integration projects. Disl will support data modeling and data mapping including support for MDA transformations and unit testing.

There is a newer version: 1.1.2
Show newest version
/*
 * Copyright 2015 - 2016 Karel H?bl .
 *
 * This file is part of disl.
 *
 * Disl is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Disl is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Disl.  If not, see .
 */
package org.disl.meta

import groovy.transform.CompileStatic

/**
 * Abstract implementation of basic SQLExpression operators.
 * */
@CompileStatic
abstract class AbstractSqlExpression {
	
	AbstractSqlExpression plus(Object o) {
		return new SqlExpression( expression: {"${this}+${o}"})
	}
	
	AbstractSqlExpression minus(Object o) {
		return new SqlExpression( expression: {"${this}-${o}"})
	}
	
	AbstractSqlExpression multiply(Object o) {
		return new SqlExpression( expression: {"${this}*${o}"})
	}
	
	AbstractSqlExpression div(Object o) {
		return new SqlExpression( expression: {"${this}/${o}"})
	}
	
	AbstractSqlExpression mod(Object o) {
		return new SqlExpression( expression: {"${this}%${o}"})
	}
	
	AbstractSqlExpression or(Object o) {
		return new SqlExpression( expression: {"${this} or ${o}"})
	}
	
	AbstractSqlExpression and(Object o) {
		return new SqlExpression( expression: {"${this} and ${o}"})
	}
		
	AbstractSqlExpression concat(Object... o) {
		return new SqlExpression( expression: {"${this}||${o.join('||')}"})
	}
	
	AbstractSqlExpression IN (Object... o) {
		return new SqlExpression( expression: {"${this} IN (${o.join(',')})"})
	}
	
	AbstractSqlExpression isEqual(Object o) {
		return new SqlExpression( expression: {"${this.toString()}=${o.toString()}"})
	}
	
	AbstractSqlExpression isNotEqual(Object o) {
		return new SqlExpression( expression: {"${this.toString()}<>${o.toString()}"})
	}
	
	AbstractSqlExpression lessThan(Object o) {
		return new SqlExpression( expression: {"${this}<${o}"})
	}
	
	AbstractSqlExpression greaterThan(Object o) {
		return new SqlExpression( expression: {"${this}>${o}"})
	}
	
	AbstractSqlExpression lessOrEqualThan(Object o) {
		return new SqlExpression( expression: {"${this}<=${o}"})
	}
	
	AbstractSqlExpression greaterOrEqualThan(Object o) {
		return new SqlExpression( expression: {"${this}>=${o}"})
	}
	
	AbstractSqlExpression between (Object o,Object p) {
		return new SqlExpression( expression: {"${this} between ${o} and ${p}"})
	}
	
		

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy