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

com.hundsun.lightdb.unisql.golang.SqlState Maven / Gradle / Ivy

There is a newer version: 24.1.7.0-beta-2
Show newest version
package com.hundsun.lightdb.unisql.golang;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * @Description: note
 * @Author: wuxiaojun
 * @Date: 2023/11/9 14:22
 **/
@Getter
@AllArgsConstructor
public enum SqlState {
    /**
     * success
     */
    SUCCESS("00000","SUCCESS"),

    /**
     * PARSE ERROR
     */
    PARSE_ERROR("56098","PARSE ERROR"),

    /**
     * CONVERT ERROR
     */
    CONVERT_ERROR("57017","CONVERT ERROR"),

    /**
     * RESTORE ERROR
     */
    RESTORE_ERROR("55061","RESTORE ERROR"),;

    private final String state;
    private final String value;


    public static String getValue(String state) {
        for (SqlState e : SqlState.values()){
            if (e.getState().equals(state)) {
                return e.getValue();
            }
        }
        return state;
    }

    public static boolean containsErrorCode(String state) {
        if (SUCCESS.getState().equals(state)){
            return false;
        }
        for (SqlState constant : SqlState.values()) {
            if (constant.getState().equals(state)) {
                return true;
            }
        }
        return false;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy