org.disl.meta.SqlOperators.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of disl Show documentation
Show all versions of disl Show documentation
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.
/*
* Copyright 2015 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
/**
* Abstract implementation of basic SQLExpression operators.
* */
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