kantan.csv

package kantan.csv

Members list

Packages

package kantan.csv.ops

Type members

Classlikes

object CellCodec extends CodecCompanion[String, DecodeError, codecs.type], PlatformSpecificCellCodecInstances

Declares helpful methods for CellCodec creation.

Declares helpful methods for CellCodec creation.

Attributes

Supertypes
trait CodecCompanion[String, DecodeError, codecs.type]
class Object
trait Matchable
class Any
Self type
CellCodec.type

All default CellCodec instances.

All default CellCodec instances.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object codecs
object CellDecoder extends DecoderCompanion[String, DecodeError, codecs.type], PlatformSpecificCellDecoderInstances

Provides useful methods for summoning and creating instances of CellDecoder.

Provides useful methods for summoning and creating instances of CellDecoder.

Attributes

Supertypes
trait DecoderCompanion[String, DecodeError, codecs.type]
trait Serializable
class Object
trait Matchable
class Any
Show all
Self type

All default CellDecoder instances.

All default CellDecoder instances.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object codecs
object CellEncoder extends EncoderCompanion[String, codecs.type], PlatformSpecificCellEncoderInstances

Provides useful methods for summoning and creating instances of CellEncoder.

Provides useful methods for summoning and creating instances of CellEncoder.

Attributes

Supertypes
trait EncoderCompanion[String, codecs.type]
class Object
trait Matchable
class Any
Self type

All default CellEncoder instances.

All default CellEncoder instances.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object codecs
final case class CsvConfiguration(cellSeparator: Char, quote: Char, quotePolicy: QuotePolicy, header: Header)

Configuration for how to read / write CSV data.

Configuration for how to read / write CSV data.

Note that all engines don't necessarily support all features.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
object CsvReader

Provides instance creation and summoning methods.

Provides instance creation and summoning methods.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
CsvReader.type

Type class for all types that can be turned into CsvWriter instances.

Type class for all types that can be turned into CsvWriter instances.

Instances of CsvSink are rarely used directly. The preferred, idiomatic way is to use the implicit syntax provided by CsvSinkOps, brought in scope by importing kantan.csv.ops._.

See the companion object for default implementations and construction methods.

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Self type
CsvSink[S]
object CsvSink

Provides default instances as well as instance summoning and creation methods.

Provides default instances as well as instance summoning and creation methods.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
CsvSink.type
trait CsvSource[-S] extends Serializable

Turns instances of S into valid sources of CSV data.

Turns instances of S into valid sources of CSV data.

Instances of CsvSource are rarely used directly. The preferred, idiomatic way is to use the implicit syntax provided by CsvSourceOps, brought in scope by importing kantan.csv.ops._.

See the companion object for default implementations and construction methods.

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Self type
object CsvSource

Defines convenience methods for creating and retrieving instances of CsvSource.

Defines convenience methods for creating and retrieving instances of CsvSource.

Implicit default implementations of standard types are also declared here, always bringing them in scope with a low priority.

These default implementations can also be useful when writing more complex instances: if you need to write a CsvSource[T] and have both a CsvSource[S] and a T ⇒ S, you need just use CsvSource.contramap to create your implementation.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
CsvSource.type
trait CsvWriter[A] extends VersionSpecificCsvWriter[A], Closeable

Type of values that know how to write CSV data.

Type of values that know how to write CSV data.

There should almost never be a reason to implement this trait directly. The default implementation should satisfy most needs, and others can be swapped if needed through the kantan.csv.engine.WriterEngine mechanism.

Type parameters

A

type of values that will be encoded as CSV.

Attributes

Companion
object
Supertypes
trait Closeable
trait AutoCloseable
class Object
trait Matchable
class Any
Show all
Self type
object CsvWriter

Provides useful instance creation methods.

Provides useful instance creation methods.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
CsvWriter.type
sealed abstract class DecodeError(msg: String) extends ReadError

Parent type for all errors that can occur while decoding CSV data.

Parent type for all errors that can occur while decoding CSV data.

Attributes

Companion
object
Supertypes
class ReadError
class Error
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
Known subtypes
class OutOfBounds
class TypeError
object DecodeError

Declares all possible values of type DecodeError.

Declares all possible values of type DecodeError.

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
object DecodeResult extends WithError[DecodeError]

Provides convenience methods for creating instances of DecodeResult.

Provides convenience methods for creating instances of DecodeResult.

Attributes

Supertypes
class WithError[DecodeError]
trait WithDefault[DecodeError]
trait Simple[DecodeError]
trait Simple[DecodeError]
class Object
trait Matchable
class Any
Show all
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object HeaderCodec

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object HeaderDecoder

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object HeaderEncoder

Defines RowDecoder instances for types with various arities.

Defines RowDecoder instances for types with various arities.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object RowCodec

Provides RowDecoder instance construction methods.

Provides RowDecoder instance construction methods.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object RowDecoder

Provides RowEncoder instance construction methods.

Provides RowEncoder instance construction methods.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object RowEncoder
trait HeaderCodec[A] extends HeaderEncoder[A], HeaderDecoder[A]

Attributes

Companion
object
Supertypes
trait HeaderDecoder[A]
trait HeaderEncoder[A]
trait Serializable
class Object
trait Matchable
class Any
Show all

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait HeaderDecoder[A] extends Serializable

Provides support for using header values rather than row indexes for decoding.

Provides support for using header values rather than row indexes for decoding.

When decoding CSV data, if the CsvConfiguration indicates the presence of a header, it will be passed to fromHeader, and the resulting RowDecoder will be used.

The default behaviour is always to rely on indexes (that is, any instance of RowDecoder that might be available), but you can create more useful HeaderDecoder instances through the companion object.

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
trait HeaderCodec[A]
Self type

Provides instance summoning and creation methods for HeaderDecoder.

Provides instance summoning and creation methods for HeaderDecoder.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait HeaderEncoder[A] extends Serializable

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
trait HeaderCodec[A]

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
sealed abstract class ParseError(msg: String) extends ReadError

Parent type for all errors that can occur while parsing CSV data.

Parent type for all errors that can occur while parsing CSV data.

Attributes

Companion
object
Supertypes
class ReadError
class Error
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
Known subtypes
class IOError
object NoSuchElement
object ParseError

Declares all possible values of type ParseError.

Declares all possible values of type ParseError.

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
ParseError.type
object ParseResult extends WithDefault[ParseError]

Provides convenience methods for creating instances of ParseResult.

Provides convenience methods for creating instances of ParseResult.

Attributes

Supertypes
trait WithDefault[ParseError]
trait Simple[ParseError]
trait Simple[ParseError]
class Object
trait Matchable
class Any
Show all
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object CellCodec

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object CellDecoder

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object CellEncoder
sealed abstract class ReadError(msg: String) extends Error

Parent type for all errors that can occur while dealing with CSV data.

Parent type for all errors that can occur while dealing with CSV data.

ReadError is split into two main error types:

  • DecodeError: errors that occur while decoding a cell or a row.
  • ParseError: errors that occur while parsing raw data into CSV.

Attributes

Supertypes
class Error
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
Known subtypes
class DecodeError
class OutOfBounds
class TypeError
class ParseError
class IOError
object NoSuchElement
Show all
object ReadResult extends Simple[ReadError]

Provides useful methods for creating instances of ReadResult.

Provides useful methods for creating instances of ReadResult.

Attributes

Supertypes
trait Simple[ReadError]
trait Simple[ReadError]
class Object
trait Matchable
class Any
Self type
ReadResult.type
object RowCodec extends GeneratedRowCodecs, CodecCompanion[Seq[String], DecodeError, codecs.type]

Provides useful methods for RowCodec instance creation.

Provides useful methods for RowCodec instance creation.

Attributes

Supertypes
trait CodecCompanion[Seq[String], DecodeError, codecs.type]
class Object
trait Matchable
class Any
Self type
RowCodec.type

All default RowCodec instances.

All default RowCodec instances.

Attributes

Supertypes
class Object
trait Matchable
class Any
Show all
Known subtypes
object codecs
object RowDecoder extends GeneratedRowDecoders, DecoderCompanion[Seq[String], DecodeError, codecs.type]

Provides various instance creation and summoning methods.

Provides various instance creation and summoning methods.

The instance creation functions are important to know about, as they make the task of creating new decoders easier and more correct. There are two main families, depending on the type to decode:

  • decoder: creates decoders from a function of arity XXX and for which you need to specify a mapping ''parameter to row index'' (such as if the order in which cells are written doesn't match that of the function's parameters).
  • ordered: create decoders from a function of arity XXX such that its parameters are organised in exactly the same way as CSV rows.

Note that a lot of types already have implicit instances: tuples, collections... moreover, the generics module can automatically derive valid instances for a lot of common scenarios.

Attributes

Supertypes
trait DecoderCompanion[Seq[String], DecodeError, codecs.type]
trait Serializable
class Object
trait Matchable
class Any
Show all
Self type
RowDecoder.type

Provides reasonable default RowDecoder instances for various types.

Provides reasonable default RowDecoder instances for various types.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object codecs
object RowEncoder extends GeneratedRowEncoders, EncoderCompanion[Seq[String], codecs.type]

Provides various instance creation and summoning methods.

Provides various instance creation and summoning methods.

The instance creation functions are important to know about, as they make the task of creating new encoders easier and more correct. There are four main families, depending on the type to encode:

  • encoder: creates encoders from a function for which you need to specify a mapping ''row index to parameter'' (such as if you need to skip some CSV cells, for instance).
  • ordered: create encoders from a function such that its parameters are organised in exactly the same way as CSV rows.
  • caseEncoder: specialisation of encoder for case classes.
  • caseOrdered: specialisation of ordered for case classes.

Note that a lot of types already have implicit instances: tuples, collections... moreover, the generics module can automatically derive valid instances for a lot of common scenarios.

Attributes

Supertypes
trait EncoderCompanion[Seq[String], codecs.type]
class Object
trait Matchable
class Any
Self type
RowEncoder.type

Provides reasonable default RowEncoder instances for various types.

Provides reasonable default RowEncoder instances for various types.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object codecs

Provides RowDecoder and RowEncoder instances for tuples of any arity.

Provides RowDecoder and RowEncoder instances for tuples of any arity.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object codecs

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait CsvSink[S]
Self type
CsvSink[S]

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait CsvWriter[A]
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Zippable[-A, -B]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Zippable extends ZippableOps1

Attributes

Companion
trait
Supertypes
trait ZippableOps1
trait ZippableOps2
trait ZippableOps3
class Object
trait Matchable
class Any
Show all
Self type
Zippable.type
trait ZippableOps1 extends ZippableOps2

Attributes

Supertypes
trait ZippableOps2
trait ZippableOps3
class Object
trait Matchable
class Any
Known subtypes
object Zippable
trait ZippableOps2 extends ZippableOps3

Attributes

Supertypes
trait ZippableOps3
class Object
trait Matchable
class Any
Known subtypes
trait ZippableOps1
object Zippable
trait ZippableOps3

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait ZippableOps2
trait ZippableOps1
object Zippable

Defines default instances for CellEncoder, CellDecoder, RowEncoder and RowDecoder.

Defines default instances for CellEncoder, CellDecoder, RowEncoder and RowDecoder.

Attributes

Supertypes
Self type
codecs.type

Types

type CellCodec[A] = Codec[String, A, DecodeError, codecs.type]

Aggregates a CellEncoder and a CellDecoder.

Aggregates a CellEncoder and a CellDecoder.

The sole purpose of this type class is to provide a convenient way to create encoders and decoders. It should not be used directly for anything but instance creation - in particular, it should never be used in a context bound or expected as an implicit parameter.

Attributes

See also

kantan.codecs.Codec

type CellDecoder[A] = Decoder[String, A, DecodeError, codecs.type]

Describes how to decode CSV cells into specific types.

Describes how to decode CSV cells into specific types.

All types A such that there exists an implicit instance of CellDecoder[A] in scope can be decoded from CSV cells.

Note that instances of this type class are rarely used directly - their purpose is to be implicitly assembled into more complex instances of kantan.csv.RowDecoder.

See the companion object for creation and summoning methods.

Type parameters

A

type this instance know to decode from.

Attributes

See also

kantan.codecs.Decoder

type CellEncoder[A] = Encoder[String, A, codecs.type]

Describes how to encode values of a specific type to CSV cells.

Describes how to encode values of a specific type to CSV cells.

All types A such that there exists an implicit instance of CellEncoder[A] in scope can be encoded to CSV cells.

Note that instances of this type class are rarely used directly - their purpose is to be implicitly assembled into more complex instances of RowEncoder.

See the companion object for creation and summoning methods.

Type parameters

A

type this instance knows to encode to.

Attributes

See also

kantan.codecs.Encoder

type CsvReader[A] = ResourceIterator[A]

Iterator on CSV data.

Iterator on CSV data.

Attributes

Result of a decode operation.

Result of a decode operation.

The difference between a parse and a decode result is that the former comes from reading raw data and trying to interpret it as CSV, while the later comes from turning CSV data into useful Scala types.

Failure cases are all encoded as DecodeError.

Attributes

type ParseResult[A] = Either[ParseError, A]

Result of a parsing operation.

Result of a parsing operation.

The difference between a parse and a decode result is that the former comes from reading raw data and trying to interpret it as CSV, while the later comes from turning CSV data into useful Scala types.

Failure cases are all encoded as ParseError.

Attributes

type ReadResult[A] = Either[ReadError, A]

Result of a reading operation.

Result of a reading operation.

Both kantan.csv.ParseResult and DecodeResult are valid values of type ReadResult.

Attributes

type RowCodec[A] = Codec[Seq[String], A, DecodeError, codecs.type]

Aggregates a RowEncoder and a RowDecoder.

Aggregates a RowEncoder and a RowDecoder.

The sole purpose of this type class is to provide a convenient way to create encoders and decoders. It should not be used directly for anything but instance creation - in particular, it should never be used in a context bound or expected as an implicit parameter.

Attributes

See also

kantan.codecs.Codec

type RowDecoder[A] = Decoder[Seq[String], A, DecodeError, codecs.type]

Describes how to decode CSV rows into specific types.

Describes how to decode CSV rows into specific types.

See the companion object for creation and summoning methods.

Type parameters

A

type this instance know to decode from.

Attributes

See also

kantan.codecs.Decoder

type RowEncoder[A] = Encoder[Seq[String], A, codecs.type]

Describes how to encode values of a specific type to CSV rows.

Describes how to encode values of a specific type to CSV rows.

See the companion object for creation and summoning methods.

Type parameters

A

type this instance knows to encode to.

Attributes

See also

kantan.codecs.Encoder

Value members

Concrete fields

Implicits

Inherited implicits

Attributes

Inherited from:
HeaderDecoderOps0

Attributes

Inherited from:
HeaderDecoderOps1