An adapter for using Timex DateTimes with Ecto, providing custom date/time types for Elixir applications.
Timex Ecto is a plugin that integrates the Timex date/time library with Ecto, Elixir's database wrapper and query generator. It enables developers to use Timex's enhanced DateTime structs directly in their Ecto schemas, replacing Ecto's built-in date/time types with more feature-rich alternatives. This bridges the gap between Timex's powerful date/time handling and Ecto's persistence layer for advanced functionality in Elixir applications.
Elixir developers using Ecto for database interactions who require advanced date and time handling beyond Ecto's built-in types, such as those needing timezone support or microsecond precision.
Developers choose Timex Ecto because it seamlessly integrates Timex's robust date/time features into Ecto schemas, offering custom types like DateTimeWithTimezone for preserving timezone data and microsecond precision support, which are not available in standard Ecto types.
An adapter for using Timex DateTimes with Ecto
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides DateTimeWithTimezone and TimestampWithTimezone types that preserve timezone data in the database, as demonstrated in the example where datetimes are stored with specific timezones like 'Europe/Copenhagen'.
Allows easy replacement of Ecto's default types and the timestamps macro, enabling consistent use of Timex structs across models, with global configuration support in Phoenix via web.ex.
Supports timestamps down to microsecond level by passing 'usec: true' in the timestamps options, providing finer granularity than Ecto's standard types, as shown in the precision configuration section.
Integrates smoothly with Phoenix by allowing global defaults in web.ex, making it easy to apply Timex timestamps across all models in a Phoenix application, as outlined in the README.
Requires strict version compatibility with Timex (e.g., Timex 3.0.2+ for timex_ecto 3.x), which can complicate updates and maintenance in projects with multiple dependencies.
Types like DateTimeWithTimezone need special handling and additional documentation, adding setup complexity compared to straightforward Ecto types, as warned in the README.
Developers must understand both Timex's date/time handling and Ecto's schema definitions, which can increase onboarding time for teams new to Elixir's date/time libraries.
Adds an extra layer of abstraction between Ecto and the database, which might introduce slight performance trade-offs in date/time serialization and deserialization compared to native types.