pub enum GreaterThan {
Gt(Timestamp),
Gte(Timestamp),
GtNow(bool),
}
Variants§
Gt(Timestamp)
gt
requires the timestamp field value to be greater than the specified
value (exclusive). If the value of gt
is larger than a specified lt
or lte
, the range is reversed, and the field value must be outside the
specified range. If the field value doesn’t meet the required conditions,
an error message is generated.
message MyTimestamp {
// timestamp must be greater than '2023-01-01T00:00:00Z' \[timestamp.gt\]
google.protobuf.Timestamp value = 1 \[(buf.validate.field).timestamp.gt = { seconds: 1672444800 }\];
// timestamp must be greater than '2023-01-01T00:00:00Z' and less than '2023-01-02T00:00:00Z' \[timestamp.gt_lt\]
google.protobuf.Timestamp another_value = 2 \[(buf.validate.field).timestamp = { gt: { seconds: 1672444800 }, lt: { seconds: 1672531200 } }\];
// timestamp must be greater than '2023-01-02T00:00:00Z' or less than '2023-01-01T00:00:00Z' \[timestamp.gt_lt_exclusive\]
google.protobuf.Timestamp other_value = 3 \[(buf.validate.field).timestamp = { gt: { seconds: 1672531200 }, lt: { seconds: 1672444800 } }\];
}
Gte(Timestamp)
gte
requires the timestamp field value to be greater than or equal to the
specified value (exclusive). If the value of gte
is larger than a
specified lt
or lte
, the range is reversed, and the field value
must be outside the specified range. If the field value doesn’t meet
the required conditions, an error message is generated.
message MyTimestamp {
// timestamp must be greater than or equal to '2023-01-01T00:00:00Z' \[timestamp.gte\]
google.protobuf.Timestamp value = 1 \[(buf.validate.field).timestamp.gte = { seconds: 1672444800 }\];
// timestamp must be greater than or equal to '2023-01-01T00:00:00Z' and less than '2023-01-02T00:00:00Z' \[timestamp.gte_lt\]
google.protobuf.Timestamp another_value = 2 \[(buf.validate.field).timestamp = { gte: { seconds: 1672444800 }, lt: { seconds: 1672531200 } }\];
// timestamp must be greater than or equal to '2023-01-02T00:00:00Z' or less than '2023-01-01T00:00:00Z' \[timestamp.gte_lt_exclusive\]
google.protobuf.Timestamp other_value = 3 \[(buf.validate.field).timestamp = { gte: { seconds: 1672531200 }, lt: { seconds: 1672444800 } }\];
}
GtNow(bool)
gt_now
specifies that this field, of the google.protobuf.Timestamp
type, must be greater than the current time. gt_now
can only be used with the within
rule.
message MyTimestamp {
// value must be greater than now
google.protobuf.Timestamp created_at = 1 \[(buf.validate.field).timestamp.gt_now = true\];
}
Implementations§
Source§impl GreaterThan
impl GreaterThan
Sourcepub fn merge(
field: &mut Option<GreaterThan>,
tag: u32,
wire_type: WireType,
buf: &mut impl Buf,
ctx: DecodeContext,
) -> Result<(), DecodeError>
pub fn merge( field: &mut Option<GreaterThan>, tag: u32, wire_type: WireType, buf: &mut impl Buf, ctx: DecodeContext, ) -> Result<(), DecodeError>
Decodes an instance of the message from a buffer, and merges it into self.
Sourcepub fn encoded_len(&self) -> usize
pub fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
Trait Implementations§
Source§impl Clone for GreaterThan
impl Clone for GreaterThan
Source§fn clone(&self) -> GreaterThan
fn clone(&self) -> GreaterThan
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for GreaterThan
impl Debug for GreaterThan
Source§impl PartialEq for GreaterThan
impl PartialEq for GreaterThan
impl Copy for GreaterThan
impl StructuralPartialEq for GreaterThan
Auto Trait Implementations§
impl Freeze for GreaterThan
impl RefUnwindSafe for GreaterThan
impl Send for GreaterThan
impl Sync for GreaterThan
impl Unpin for GreaterThan
impl UnwindSafe for GreaterThan
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request