001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to you under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package gudusoft.gsqlparser.ext.calcite.catalog; 018 019import org.checkerframework.checker.nullness.qual.Nullable; 020 021/** 022 * Represents a column in a database table. 023 * 024 * <p>This is a standalone version that can be used independently of Apache Calcite. 025 */ 026public interface Column { 027 /** 028 * Returns the name of the column. 029 * 030 * @return Column name 031 */ 032 String getName(); 033 034 /** 035 * Returns the SQL type name of the column (e.g., "VARCHAR", "INTEGER", "DECIMAL"). 036 * 037 * @return SQL type name 038 */ 039 String getTypeName(); 040 041 /** 042 * Returns the ordinal position of the column in the table (1-based). 043 * 044 * @return Ordinal position 045 */ 046 int getOrdinalPosition(); 047 048 /** 049 * Returns whether the column allows NULL values. 050 * 051 * @return true if nullable, false otherwise 052 */ 053 boolean isNullable(); 054 055 /** 056 * Returns the column size (e.g., VARCHAR length, INTEGER precision). 057 * 058 * @return Column size, or null if not applicable 059 */ 060 @Nullable Integer getSize(); 061 062 /** 063 * Returns the number of decimal digits (for numeric types). 064 * 065 * @return Decimal digits, or null if not applicable 066 */ 067 @Nullable Integer getDecimalDigits(); 068 069 /** 070 * Returns the default value of the column. 071 * 072 * @return Default value, or null if none 073 */ 074 @Nullable String getDefaultValue(); 075 076 /** 077 * Returns the comment or description of the column. 078 * 079 * @return Column comment, or null if none 080 */ 081 @Nullable String getComment(); 082}