Record Class CsvFileSourceConfig
java.lang.Object
java.lang.Record
com.darkcollective.relix.lang.ast.source.CsvFileSourceConfig
- Record Components:
path- the file system path to the CSV file; must not be blankhasHeader-trueif the first row contains column namescolumns- the ordered column specifications; must not be emptyreferences- the declared column references; may be empty
- All Implemented Interfaces:
SourceConfig
public record CsvFileSourceConfig(String path, boolean hasHeader, List<ColumnSpec> columns, List<ColumnReference> references)
extends Record
implements SourceConfig
Configuration for a local CSV file source.
Example:
source Products from csv("./products.csv") {
schema: {
id: NUMBER,
name: STRING,
price: NUMBER
}
};
When hasHeader() is true the first row of the file is
treated as a header row and matched against the schema column names. When
false columns are matched positionally.
An optional references: block declares foreign-key style
relationships from this source's columns to other relations.
-
Constructor Summary
ConstructorsConstructorDescriptionCsvFileSourceConfig(String path, boolean hasHeader, List<ColumnSpec> columns) Creates a config with no declared references.CsvFileSourceConfig(String path, boolean hasHeader, List<ColumnSpec> columns, List<ColumnReference> references) Creates an instance of aCsvFileSourceConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncolumns()Returns the value of thecolumnsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns the value of thehasHeaderrecord component.path()Returns the value of thepathrecord component.Returns the value of thereferencesrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CsvFileSourceConfig
public CsvFileSourceConfig(String path, boolean hasHeader, List<ColumnSpec> columns, List<ColumnReference> references) Creates an instance of aCsvFileSourceConfigrecord class.- Parameters:
path- the value for thepathrecord componenthasHeader- the value for thehasHeaderrecord componentcolumns- the value for thecolumnsrecord componentreferences- the value for thereferencesrecord component
-
CsvFileSourceConfig
Creates a config with no declared references.
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-
hasHeader
public boolean hasHeader()Returns the value of thehasHeaderrecord component.- Returns:
- the value of the
hasHeaderrecord component
-
columns
Returns the value of thecolumnsrecord component.- Returns:
- the value of the
columnsrecord component
-
references
Returns the value of thereferencesrecord component.- Returns:
- the value of the
referencesrecord component
-