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

tech.ydb.jooq.dsl.function.builtin.Find 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 Find extends AbstractYdbFunction {

    private static final Name FIND = systemName("find");

    private final Field source;
    private final Field substring;
    private final Field startingPosition;

    public Find(Field source, Field substring, Field startingPosition) {
        super(
                FIND,
                YdbTypes.UINT32
        );

        this.source = source;
        this.substring = substring;
        this.startingPosition = startingPosition;
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy