com.github.tonivade.puredbc.sql.SQL5 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of puredbc Show documentation
Show all versions of puredbc Show documentation
Pure Functional Database Connection Layer
The newest version!
/*
* Copyright (c) 2020-2024, Antonio Gabriel Muñoz Conejo
* Distributed under the terms of the MIT License
*/
package com.github.tonivade.puredbc.sql;
import static com.github.tonivade.purefun.core.Precondition.checkNonEmpty;
import static com.github.tonivade.purefun.data.Sequence.arrayOf;
public final class SQL5 {
private final String query;
protected SQL5(String query) {
this.query = checkNonEmpty(query);
}
public SQL bind(A a, B b, C c, D d, E e) {
return new SQL(query, arrayOf(a, b, c, d, e));
}
public SQL5 groupBy(Field field) {
return new SQL5<>(query + " group by " + field.render());
}
public SQL5 orderBy(Field field) {
return new SQL5<>(query + " order by " + field.render());
}
public SQL5 asc() {
return new SQL5<>(query + " asc");
}
public SQL5 desc() {
return new SQL5<>(query + " desc");
}
public SQL5 limit(int limit) {
return new SQL5<>(query + " limit " + limit);
}
public SQL5 offset(int offset) {
return new SQL5<>(query + " offset " + offset);
}
@Override
public String toString() {
return String.format("SQL5{query='%s'}", query);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy