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
- Host: GitHub
- URL: https://github.com/elixir-protobuf/google-protos
- Owner: elixir-protobuf
- License: mit
- Created: 2018-02-28T02:13:10.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-02-20T06:26:59.000Z (almost 2 years ago)
- Last Synced: 2024-12-24T05:34:46.037Z (about 1 year ago)
- Topics: elixir, elixir-lang, protobuf, protobuf-elixir
- Language: Elixir
- Homepage:
- Size: 18.6 KB
- Stars: 16
- Watchers: 4
- Forks: 21
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)
```