CSV

io.github.quafadas.scautable.CSV
object CSV

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
CSV.type

Members list

Value members

Concrete methods

transparent inline def absolutePath[T](inline csvContent: String): Any

Reads a CSV file from an absolute path and returns a io.github.quafadas.scautable.CsvIterator.

Reads a CSV file from an absolute path and returns a io.github.quafadas.scautable.CsvIterator.

Example:

 val csv: CsvIterator[("colA", "colB", "colC")] = CSV.absolutePath("/absolute/path/to/file.csv")

Attributes

transparent inline def absolutePath[T](inline csvContent: String, inline headers: HeaderOptions): Any
transparent inline def absolutePath[T](inline csvContent: String, inline dataType: TypeInferrer): Any
transparent inline def absolutePath[T](inline path: String, inline headers: HeaderOptions, inline dataType: TypeInferrer): Any
transparent inline def absolutePath[T](inline path: String, inline opts: CsvOpts): CsvIterator[_ <: Tuple, _ <: Tuple]
transparent inline def fromString[T](inline csvContent: String): Any

Reads a CSV from a String and returns a io.github.quafadas.scautable.CsvIterator.

Reads a CSV from a String and returns a io.github.quafadas.scautable.CsvIterator.

Example:

val csvContent = "colA,colB\n1,a\n2,b"
val csv: CsvIterator[("colA", "colB")] = CSV.fromString(csvContent)

Attributes

transparent inline def fromString[T](inline csvContent: String, inline headers: HeaderOptions): Any
transparent inline def fromString[T](inline csvContent: String, inline dataType: TypeInferrer): Any
transparent inline def fromString[T](inline csvContent: String, inline headers: HeaderOptions, inline dataType: TypeInferrer): Any
transparent inline def fromString[T](inline csvContent: String, inline opts: CsvOpts): CsvIterator[_ <: Tuple, _ <: Tuple]
inline def fromTyped[K <: Tuple, V <: Tuple]: Path => CsvIterator[K, V]

Creates a function that reads a CSV file from a runtime path and returns a io.github.quafadas.scautable.CsvIterator.

Creates a function that reads a CSV file from a runtime path and returns a io.github.quafadas.scautable.CsvIterator.

Unlike other CSV methods that require the file path at compile time, this method allows you to specify the column types at compile time but provide the file path at runtime. This is useful when you know the structure of a CSV file in advance but the actual file location is determined at runtime.

Example:

 val csvReader = CSV.fromTyped[("name", "age", "salary"), (String, Int, Double)]
 val data = csvReader(os.pwd / "employees.csv")
 // data is a CsvIterator[("name", "age", "salary"), (String, Int, Double)]

Type parameters

K

A tuple of string literal types representing the column names

V

A tuple of types representing the column value types (must have Decoders available)

Attributes

Returns

A function that takes an os.Path and returns a CsvIterator with the specified types

transparent inline def pwd[T](inline csvContent: String): Any

Reads a CSV present in the current compiler working directory resources and returns a io.github.quafadas.scautable.CsvIterator.

Reads a CSV present in the current compiler working directory resources and returns a io.github.quafadas.scautable.CsvIterator.

Note that in most cases, this is not the same as the current runtime working directory, and you are likely to get the bloop server directory.

Hopefully, useful in almond notebooks.

Example:

 val csv: CsvIterator[("colA", "colB", "colC")] = CSV.pwd("file.csv")

Attributes

transparent inline def pwd[T](inline csvContent: String, inline headers: HeaderOptions): Any
transparent inline def pwd[T](inline csvContent: String, inline dataType: TypeInferrer): Any
transparent inline def pwd[T](inline path: String, inline headers: HeaderOptions, inline dataType: TypeInferrer): Any
transparent inline def pwd[T](inline path: String, inline opts: CsvOpts): CsvIterator[_ <: Tuple, _ <: Tuple]
def readCsvAbsolutePath(pathExpr: Expr[String], optsExpr: Expr[CsvOpts])(using Quotes): Expr[CsvIterator[_ <: Tuple, _ <: Tuple]]
transparent inline def resource[T](inline csvContent: String): Any

Reads a CSV present in java resources and returns a io.github.quafadas.scautable.CsvIterator.

Reads a CSV present in java resources and returns a io.github.quafadas.scautable.CsvIterator.

Example:

 val csv: CsvIterator[("colA", "colB", "colC")] = CSV.resource("file.csv")

Attributes

transparent inline def resource[T](inline csvContent: String, inline headers: HeaderOptions): Any
transparent inline def resource[T](inline csvContent: String, inline dataType: TypeInferrer): Any
transparent inline def resource[T](inline path: String, inline headers: HeaderOptions, inline dataType: TypeInferrer): Any
transparent inline def resource[T](inline path: String, inline opts: CsvOpts): CsvIterator[_ <: Tuple, _ <: Tuple]
transparent inline def url[T](inline csvContent: String): Any

Saves a URL to a local CSV returns a io.github.quafadas.scautable.CsvIterator.

Saves a URL to a local CSV returns a io.github.quafadas.scautable.CsvIterator.

Example:

 val csv: CsvIterator[("colA", "colB", "colC")] = CSV.url("https://somewhere.com/file.csv")

Attributes

transparent inline def url[T](inline csvContent: String, inline headers: HeaderOptions): Any
transparent inline def url[T](inline csvContent: String, inline dataType: TypeInferrer): Any
transparent inline def url[T](inline path: String, inline headers: HeaderOptions, inline dataType: TypeInferrer): Any
transparent inline def url[T](inline path: String, inline opts: CsvOpts): CsvIterator[_ <: Tuple, _ <: Tuple]