Skip to content

halomakes/BigQueryMapping

Repository files navigation

BigQueryMapper

Source generator utility for converting BigQueryRows to your DTO.

Usage

Install NuGet packages

dotnet add package BigQueryMapping
dotnet add package BigQueryMapping.Generators

Apply attribute to your partial class

Any property with an accessible setter will be included in mapping. You can specify a column name using a ColumnAttribute.

using BigQueryMapping

[BigQueryMapped]
public partial class MyRowDto
{
  public string SomeId { get; set; }
  
  [Column("some_RiDiCuLoUs_name")]
  public string SensibleName { get; set; }
}

The souce generator will implement IBigQueryGenerated<MyRowDto> which has a static method FromBigQueryRow(BigQueryRow row) that you can use to get your DTO out.

var rows = await _bigQuery.ExecuteQueryAsync(sql, parameters, cancellationToken, new());

foreach (var row in rows)
{
    yield return MyRowDto.From(row);
}

About

Source generator for working with BigQuery Storage API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages