An open API service indexing awesome lists of open source software.

https://github.com/elixir-protobuf/google-protos

Elixir files generated from Google's protobuf files using protobuf-elixir
https://github.com/elixir-protobuf/google-protos

elixir elixir-lang protobuf protobuf-elixir

Last synced: 4 months ago
JSON representation

Elixir files generated from Google's protobuf files using protobuf-elixir

Awesome Lists containing this project

README

          

# Google Protos

For Elixir files generated from [Google's protobuf files](https://github.com/google/protobuf/tree/master/src/google/protobuf) using [protobuf-elixir](https://github.com/tony612/protobuf-elixir).

> [!CAUTION]
> This repo has been **deprecated** in favor of the [main Protobuf library](https://github.com/elixir-protobuf/protobuf).
> To upgrade, remove `:google_protos` and upgrade `:protobuf` to v0.14+.

## How-To

### Convert `Google.Protobuf.Timestamp` to `DateTime`

1. Convert timestamp seconds to nanoseconds.
2. Add the timestamp nanos.
3. Convert to `DateTime` using `DateTime.from_unix!/2`.

```elixir
timestamp = Google.Protobuf.Timestamp.new(seconds: 5, nanos: 100)
DateTime.from_unix!(timestamp.seconds * 1_000_000_000 + timestamp.nanos, :nanosecond)
```