de.jaggl.sqlbuilder.functions.Now Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sqlbuilder-core Show documentation
Show all versions of sqlbuilder-core Show documentation
A Java-Library to build SQL-Statements
package de.jaggl.sqlbuilder.functions;
import java.time.ZonedDateTime;
import java.time.temporal.Temporal;
import de.jaggl.sqlbuilder.conditions.DateTimeConditions;
import de.jaggl.sqlbuilder.domain.BuildingContext;
import de.jaggl.sqlbuilder.utils.Indentation;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* @author Martin Schumacher
*
* @since 2.0.0
*/
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Now implements Function, DateTimeConditions
{
@Override
public java.util.function.Function getDateConversion()
{
return ZonedDateTime::toLocalDateTime;
}
@Getter
private String alias;
public Now as(@SuppressWarnings("hiding") String alias)
{
return new Now(alias);
}
@Override
public String getValue(BuildingContext context, Indentation indentation)
{
return "NOW()";
}
}