using System;
// ReSharper disable once CheckNamespace
namespace NpgsqlTypes;
///
/// A raw representation of the PostgreSQL interval datatype. Use only when or NodaTime
/// Period do not have sufficient range to handle your values.
///
///
///
/// See https://www.postgresql.org/docs/current/static/datatype-geometric.html.
///
///
/// Do not use this type unless you have to: prefer or NodaTime
/// Period when possible.
///
///
public readonly struct NpgsqlInterval : IEquatable
{
///
/// Constructs an .
///
public NpgsqlInterval(int months, int days, long time)
=> (Months, Days, Time) = (months, days, time);
///
/// Months and years, after time for alignment.
///
public int Months { get; }
///
/// Days, after time for alignment.
///
public int Days { get; }
///
/// Remaining time unit smaller than a day, in microseconds.
///
public long Time { get; }
///
public bool Equals(NpgsqlInterval other)
=> Months == other.Months && Days == other.Days && Time == other.Time;
///
public override bool Equals(object? obj)
=> obj is NpgsqlInterval other && Equals(other);
///
public override int GetHashCode()
=> HashCode.Combine(Months, Days, Time);
}