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

tech.ydb.jooq.dsl.function.builtin.Substring Maven / Gradle / Ivy

The newest version!
package tech.ydb.jooq.dsl.function.builtin;

import org.jooq.Context;
import org.jooq.Field;
import org.jooq.Name;
import org.jooq.impl.AbstractYdbFunction;
import org.jooq.types.UInteger;
import tech.ydb.jooq.YdbTypes;

import static org.jooq.impl.DSL.function;
import static org.jooq.impl.DSL.systemName;

public final class Substring extends AbstractYdbFunction {

    private static final Name SUBSTRING = systemName("substring");

    private final Field source;
    private final Field startingPosition;
    private final Field length;

    public Substring(Field source, Field startingPosition, Field length) {
        super(
                SUBSTRING,
                YdbTypes.STRING
        );

        this.source = source;
        this.startingPosition = startingPosition;
        this.length = length;
    }

    @Override
    public void accept(Context ctx) {
        if (length != null) {
            ctx.visit(function(SUBSTRING, getDataType(), source, startingPosition, length));
        } else {
            ctx.visit(function(SUBSTRING, getDataType(), source, startingPosition));
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy