8000 Typeful API in `kotools.csv` · Issue #14 · kotools/libraries · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.
This repository was archived by the owner on Feb 8, 2024. It is now read-only.
Typeful API in kotools.csv #14
Closed
Closed
@LVMVRQUXL

Description

@LVMVRQUXL

Description

Create a package kotools.csv containing all declarations of the package io.github.kotools.csv.
Then, deprecate all declarations of the old package.

Declarations in kotools.csv should use explicit types from Kotools Types for having a typeful design.

Also, the file property should be required in this new API for avoiding runtime checks in favor of compile-time checks.
Here is an exemple using the old API:

data class Person(val name: NotBlankString, val age: StrictlyPositiveInt, val isAdmin: Boolean = false)

suspend fun main() {
    csvWriter<Person>(file = "people".toNotBlankString()) {
        records { +Person("Nobody".toNotBlankString(), 25.toStrictlyPositiveInt()) }
    }
    val people: List<Person> = csvReader(file = "people".toNotBlankString())
    println(people)
}

Checklist

  • Implement a basic CSV reader.
  • Implement a reader that returns a custom type.
  • Deprecate the old reader.
  • Implement a basic CSV writer.
  • Implement a writer that takes a custom type.
  • Deprecate the old writer.
  • Update Work in progress section in changelog.

Metadata

Metadata

Assignees

Labels

csvRelated to Kotools CSV.enhancementNew feature or request.jvmShould work on JVM platform.wontfixThis will not be worked on.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0