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

io.tarantool.driver.api.conditions.Operator Maven / Gradle / Ivy

Go to download

Tarantool Cartridge driver for Tarantool versions 1.10+ based on Netty framework

There is a newer version: 0.14.0
Show newest version
package io.tarantool.driver.api.conditions;

import io.tarantool.driver.protocol.TarantoolIteratorType;

/**
 * Filtering condition operator. See 
 * https://github.com/tarantool/crud#select.
 *
 * @author Alexey Kuzin
 */
public enum Operator {
    EQ("="),
    LT("<"),
    LE("<="),
    GT(">"),
    GE(">=");

    private final String code;

    Operator(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public TarantoolIteratorType toIteratorType() {
        switch (this) {
            case LT: return TarantoolIteratorType.ITER_LT;
            case LE: return TarantoolIteratorType.ITER_LE;
            case GT: return TarantoolIteratorType.ITER_GT;
            case GE: return TarantoolIteratorType.ITER_GE;
            default: return TarantoolIteratorType.ITER_EQ;
        }
    }

    @Override
    public String toString() {
        return "Operator{" +
                "opCode=" + code.toString() +
                '}';
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy