Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
 into core
  • Loading branch information
AnnaSasDev committed Dec 11, 2024
2 parents 55b47c6 + 2c8923a commit f90b4f8
Show file tree
Hide file tree
Showing 17 changed files with 1,282 additions and 651 deletions.
8 changes: 4 additions & 4 deletions src/CodeOfChaos.Lucide/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/CodeOfChaos.Lucide/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"dependencies": {
"lucide-static": "^0.454.0"
"lucide-static": "^0.468.0"
}
}
10 changes: 4 additions & 6 deletions src/CodeOfChaos.Parsers.Csv.Sample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
// ---------------------------------------------------------------------------------------------------------------------
// Imports
// ---------------------------------------------------------------------------------------------------------------------
using CodeOfChaos.Parsers.Csv.Parsers;

namespace CodeOfChaos.Parsers.Csv.Sample;
// ---------------------------------------------------------------------------------------------------------------------
// Code
// ---------------------------------------------------------------------------------------------------------------------
public static class Program {
public async static Task Main(string[] args) {
var reader = new CsvReader<EveningClassData>(cfg => {
CsvParser reader = CsvParser.FromConfig(cfg => {
cfg.ColumnSplit = ";";
cfg.IncludeHeader = true;
});

IAsyncEnumerable<EveningClassData> dataEnumerable = reader.FromCsvFileAsync("AvondSchool.csv");
IAsyncEnumerable<EveningClassData> dataEnumerable = reader.ToEnumerableAsync<EveningClassData>("AvondSchool.csv");

await foreach (EveningClassData record in dataEnumerable) {
Console.WriteLine(record.Geometry);
}

var writer = new CsvDictionaryWriter(config => {
CsvParser parser = CsvParser.FromConfig(config => {
config.ColumnSplit = ";";
config.UseLowerCaseHeaders = true;
});
Expand All @@ -30,6 +28,6 @@ public async static Task Main(string[] args) {
["data"] = "something"
};

await writer.WriteToFileAsync("test.csv", [data]);
await parser.ParseToFileAsync("test.csv", [data]);
}
}
21 changes: 20 additions & 1 deletion src/CodeOfChaos.Parsers.Csv/CodeOfChaos.Parsers.Csv.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,29 @@
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>true</IsPackable>
<PackageId>CodeOfChaos.Parsers.Csv</PackageId> <!-- Main package name -->
<Version>2.0.0</Version> <!-- Package version -->
<Authors>Anna Sas</Authors>
<Description>A small to parse CSV files</Description>
<PackageProjectUrl>https://github.com/code-of-chaos/code_of_chaos-cs</PackageProjectUrl>
<PackageTags>parser csv</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<DebugType>embedded</DebugType>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\LICENSE" Pack="true" PackagePath="" />
<None Include="..\..\README.md" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="CodeOfChaos.Extensions" Version="0.13.0"/>
</ItemGroup>

</Project>
</Project>
4 changes: 2 additions & 2 deletions src/CodeOfChaos.Parsers.Csv/Contracts/ICsvReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ namespace CodeOfChaos.Parsers.Csv.Contracts;
public interface ICsvReader<T> {
public IEnumerable<T> FromCsvFile(string filePath);
public IEnumerable<T> FromCsvString(string data);
public IAsyncEnumerable<T> FromCsvFileAsync(string filePath);
public IAsyncEnumerable<T> FromCsvStringAsync(string data);
public IAsyncEnumerable<T> FromCsvFileAsync(string filePath, CancellationToken ct = default);
public IAsyncEnumerable<T> FromCsvStringAsync(string data, CancellationToken ct = default);
}
Loading

0 comments on commit f90b4f8

Please sign in to comment.