Record Class SourceDeclaration
java.lang.Object
java.lang.Record
com.darkcollective.relix.lang.ast.SourceDeclaration
- Record Components:
exported-trueif the source is importable by other filesname- the relation name; must not be blankconfig- the transport and schema configuration; must not be nulllocation- the source location of this statement; never null
- All Implemented Interfaces:
Statement
public record SourceDeclaration(boolean exported, String name, SourceConfig config, SourceLocation location)
extends Record
implements Statement
A
source declaration — names a virtual relation backed by an
external data source.
Syntax:
source current_weather from http {
url: "https://api.example.com/weather",
method: GET,
headers: { "X-API-Key": "${WEATHER_API_KEY}" },
extract: json("$."),
schema: {
city: in STRING as query("q") [required],
temp: out NUMBER at "$.main.temp"
}
};
Multiple source declarations with the same name() but
different in-column sets represent overloads of the same virtual
relation — the query planner selects the overload whose required parameters
are satisfied by equality predicates in the query.
The exported flag is false when the declaration is
prefixed with private — the source is usable within the file but
not importable by other files.
-
Constructor Summary
ConstructorsConstructorDescriptionSourceDeclaration(boolean exported, String name, SourceConfig config) Convenience constructor for tests; usesSourceLocation.UNKNOWN.SourceDeclaration(boolean exported, String name, SourceConfig config, SourceLocation location) Creates an instance of aSourceDeclarationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionconfig()Returns the value of theconfigrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanexported()Returns the value of theexportedrecord component.final inthashCode()Returns a hash code value for this object.location()Returns the value of thelocationrecord component.name()Returns the value of thenamerecord component.static SourceDeclarationof(String name, SourceConfig config) Creates an exported source declaration (the common case).final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SourceDeclaration
public SourceDeclaration(boolean exported, String name, SourceConfig config, SourceLocation location) Creates an instance of aSourceDeclarationrecord class. -
SourceDeclaration
Convenience constructor for tests; usesSourceLocation.UNKNOWN.
-
-
Method Details
-
of
Creates an exported source declaration (the common case). -
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 '=='. -
exported
public boolean exported()Returns the value of theexportedrecord component.- Returns:
- the value of the
exportedrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
config
Returns the value of theconfigrecord component.- Returns:
- the value of the
configrecord component
-
location
Returns the value of thelocationrecord component.
-