| 1 | // Copyright 2018 Google LLC |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package typesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/ |
| 16 | |
| 17 | import ( |
| 18 | "fmtscip-go gomod github.com/golang/go/src go1.23.0 fmt/" |
| 19 | "reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/" |
| 20 | "strconvscip-go gomod github.com/golang/go/src go1.23.0 strconv/" |
| 21 | "stringsscip-go gomod github.com/golang/go/src go1.23.0 strings/" |
| 22 | "timescip-go gomod github.com/golang/go/src go1.23.0 time/" |
| 23 | |
| 24 | "github.com/google/cel-go/common/overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/" |
| 25 | "github.com/google/cel-go/common/types/refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/" |
| 26 | |
| 27 | anypbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/ "google.golang.org/protobuf/types/known/anypbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/" |
| 28 | structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/ "google.golang.org/protobuf/types/known/structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/" |
| 29 | tpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/timestamppb`/ "google.golang.org/protobuf/types/known/timestamppbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/timestamppb`/" |
| 30 | ) |
| 31 | |
| 32 | // Timestamp type implementation which supports add, compare, and subtract |
| 33 | // operations. Timestamps are also capable of participating in dynamic |
| 34 | // function dispatch to instance methods. |
| 35 | type Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp# struct { |
| 36 | timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time. |
| 37 | } |
| 38 | |
| 39 | func timestampOfscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampOf().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#) Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp# { |
| 40 | // Note that this function does not validate that time.Time is in our supported range. |
| 41 | return Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#{Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time.: t} |
| 42 | } |
| 43 | |
| 44 | const ( |
| 45 | // The number of seconds between year 1 and year 1970. This is borrowed from |
| 46 | // https://golang.org/src/time/time.go. |
| 47 | unixToInternalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/unixToInternal. int64 = (1969*365 + 1969/4 - 1969/100 + 1969/400) * (60 * 60 * 24) |
| 48 | |
| 49 | // Number of seconds between `0001-01-01T00:00:00Z` and the Unix epoch. |
| 50 | minUnixTimescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/minUnixTime. int64 = -62135596800 |
| 51 | // Number of seconds between `9999-12-31T23:59:59.999999999Z` and the Unix epoch. |
| 52 | maxUnixTimescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/maxUnixTime. int64 = 253402300799 |
| 53 | ) |
| 54 | |
| 55 | // Add implements traits.Adder.Add. |
| 56 | func (t Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#) Addscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Add().(other refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 57 | switch other.Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Type.() { |
| 58 | case DurationTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/DurationType.: |
| 59 | return other.(Durationscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Duration#).Addscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Duration#Add().(t) |
| 60 | } |
| 61 | return MaybeNoSuchOverloadErrscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/MaybeNoSuchOverloadErr().(other) |
| 62 | } |
| 63 | |
| 64 | // Compare implements traits.Comparer.Compare. |
| 65 | func (t Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#) Comparescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Compare().(other refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 66 | if TimestampTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TimestampType. != other.Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Type.() { |
| 67 | return MaybeNoSuchOverloadErrscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/MaybeNoSuchOverloadErr().(other) |
| 68 | } |
| 69 | ts1 := t.Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time. |
| 70 | ts2 := other.(Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#).Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time. |
| 71 | switch { |
| 72 | case ts1.Beforescip-go gomod github.com/golang/go/src go1.23.0 time/Time#Before().(ts2): |
| 73 | return IntNegOnescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IntNegOne. |
| 74 | case ts1.Afterscip-go gomod github.com/golang/go/src go1.23.0 time/Time#After().(ts2): |
| 75 | return IntOnescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IntOne. |
| 76 | default: |
| 77 | return IntZeroscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IntZero. |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | // ConvertToNative implements ref.Val.ConvertToNative. |
| 82 | func (t Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#) ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#ConvertToNative().(typeDesc reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.Typescip-go gomod github.com/golang/go/src go1.23.0 reflect/Type#) (any, error) { |
| 83 | // If the timestamp is already assignable to the desired type return it. |
| 84 | if reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(t.Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time.).AssignableToscip-go gomod github.com/golang/go/src go1.23.0 reflect/Type#AssignableTo().(typeDesc) { |
| 85 | return t.Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time., nil |
| 86 | } |
| 87 | if reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(t).AssignableToscip-go gomod github.com/golang/go/src go1.23.0 reflect/Type#AssignableTo().(typeDesc) { |
| 88 | return t, nil |
| 89 | } |
| 90 | switch typeDesc { |
| 91 | case anyValueTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/anyValueType.: |
| 92 | // Pack the underlying time as a tpb.Timestamp into an Any value. |
| 93 | return anypbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/.Newscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/New().(tpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/timestamppb`/.Newscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/timestamppb`/New().(t.Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time.)) |
| 94 | case JSONValueTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/JSONValueType.: |
| 95 | // CEL follows the proto3 to JSON conversion which formats as an RFC 3339 encoded JSON |
| 96 | // string. |
| 97 | v := t.ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#ConvertToType().(StringTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/StringType.) |
| 98 | if IsErrorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IsError().(v) { |
| 99 | return nil, v.(*Errscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Err#) |
| 100 | } |
| 101 | return structpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/.NewStringValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/structpb`/NewStringValue().(string(v.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#))), nil |
| 102 | case timestampValueTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampValueType.: |
| 103 | // Unwrap the underlying tpb.Timestamp. |
| 104 | return tpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/timestamppb`/.Newscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/timestamppb`/New().(t.Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time.), nil |
| 105 | } |
| 106 | return nil, fmtscip-go gomod github.com/golang/go/src go1.23.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.23.0 fmt/Errorf().("type conversion error from 'Timestamp' to '%v'", typeDesc) |
| 107 | } |
| 108 | |
| 109 | // ConvertToType implements ref.Val.ConvertToType. |
| 110 | func (t Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#) ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#ConvertToType().(typeVal refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Type#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 111 | switch typeVal { |
| 112 | case StringTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/StringType.: |
| 113 | return Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#(t.Formatscip-go gomod github.com/golang/go/src go1.23.0 time/Time#Format().(timescip-go gomod github.com/golang/go/src go1.23.0 time/.RFC3339Nanoscip-go gomod github.com/golang/go/src go1.23.0 time/RFC3339Nano.)) |
| 114 | case IntTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/IntType.: |
| 115 | // Return the Unix time in seconds since 1970 |
| 116 | return Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(t.Unixscip-go gomod github.com/golang/go/src go1.23.0 time/Time#Unix().()) |
| 117 | case TimestampTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TimestampType.: |
| 118 | return t |
| 119 | case TypeTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TypeType.: |
| 120 | return TimestampTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TimestampType. |
| 121 | } |
| 122 | return NewErrscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NewErr().("type conversion error from '%s' to '%s'", TimestampTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TimestampType., typeVal) |
| 123 | } |
| 124 | |
| 125 | // Equal implements ref.Val.Equal. |
| 126 | func (t Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#) Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Equal().(other refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 127 | otherTime, ok := other.(Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#) |
| 128 | return Boolscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Bool#(ok && t.Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time..Equalscip-go gomod github.com/golang/go/src go1.23.0 time/Time#Equal().(otherTime.Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time.)) |
| 129 | } |
| 130 | |
| 131 | // IsZeroValue returns true if the timestamp is epoch 0. |
| 132 | func (t Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#) IsZeroValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#IsZeroValue().() bool { |
| 133 | return t.IsZeroscip-go gomod github.com/golang/go/src go1.23.0 time/Time#IsZero().() |
| 134 | } |
| 135 | |
| 136 | // Receive implements traits.Receiver.Receive. |
| 137 | func (t Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#) Receivescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Receive().(function string, overload string, args []refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 138 | switch len(args) { |
| 139 | case 0: |
| 140 | if f, found := timestampZeroArgOverloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampZeroArgOverloads.[function]; found { |
| 141 | return f(t.Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time.) |
| 142 | } |
| 143 | case 1: |
| 144 | if f, found := timestampOneArgOverloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampOneArgOverloads.[function]; found { |
| 145 | return f(t.Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time., args[0]) |
| 146 | } |
| 147 | } |
| 148 | return NoSuchOverloadErrscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/NoSuchOverloadErr().() |
| 149 | } |
| 150 | |
| 151 | // Subtract implements traits.Subtractor.Subtract. |
| 152 | func (t Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#) Subtractscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Subtract().(subtrahend refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 153 | switch subtrahend.Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Type.() { |
| 154 | case DurationTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/DurationType.: |
| 155 | dur := subtrahend.(Durationscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Duration#) |
| 156 | val, err := subtractTimeDurationCheckedscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/subtractTimeDurationChecked().(t.Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time., dur.Durationscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Duration#Duration.) |
| 157 | if err != nil { |
| 158 | return WrapErrscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/WrapErr().(err) |
| 159 | } |
| 160 | return timestampOfscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampOf().(val) |
| 161 | case TimestampTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TimestampType.: |
| 162 | t2 := subtrahend.(Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#).Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time. |
| 163 | val, err := subtractTimeCheckedscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/subtractTimeChecked().(t.Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time., t2) |
| 164 | if err != nil { |
| 165 | return WrapErrscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/WrapErr().(err) |
| 166 | } |
| 167 | return durationOfscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/durationOf().(val) |
| 168 | } |
| 169 | return MaybeNoSuchOverloadErrscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/MaybeNoSuchOverloadErr().(subtrahend) |
| 170 | } |
| 171 | |
| 172 | // Type implements ref.Val.Type. |
| 173 | func (t Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#) Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Type().() refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Type# { |
| 174 | return TimestampTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/TimestampType. |
| 175 | } |
| 176 | |
| 177 | // Value implements ref.Val.Value. |
| 178 | func (t Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#) Valuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Value().() any { |
| 179 | return t.Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time. |
| 180 | } |
| 181 | |
| 182 | func (t Timestampscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#) formatscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#format().(sb *stringsscip-go gomod github.com/golang/go/src go1.23.0 strings/.Builderscip-go gomod github.com/golang/go/src go1.23.0 strings/Builder#) { |
| 183 | fmtscip-go gomod github.com/golang/go/src go1.23.0 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.23.0 fmt/Fprintf().(sb, `timestamp("%s")`, t.Timescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Timestamp#Time..UTCscip-go gomod github.com/golang/go/src go1.23.0 time/Time#UTC().().Formatscip-go gomod github.com/golang/go/src go1.23.0 time/Time#Format().(timescip-go gomod github.com/golang/go/src go1.23.0 time/.RFC3339Nanoscip-go gomod github.com/golang/go/src go1.23.0 time/RFC3339Nano.)) |
| 184 | } |
| 185 | |
| 186 | var ( |
| 187 | timestampValueTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampValueType. = reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.23.0 reflect/TypeOf().(&tpbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/timestamppb`/.Timestampscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/timestamppb`/Timestamp#{}) |
| 188 | |
| 189 | timestampZeroArgOverloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampZeroArgOverloads. = map[string]func(timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{ |
| 190 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetFullYearscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetFullYear.: timestampGetFullYearscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetFullYear()., |
| 191 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetMonthscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetMonth.: timestampGetMonthscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetMonth()., |
| 192 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetDayOfYearscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetDayOfYear.: timestampGetDayOfYearscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfYear()., |
| 193 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetDatescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetDate.: timestampGetDayOfMonthOneBasedscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfMonthOneBased()., |
| 194 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetDayOfMonthscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetDayOfMonth.: timestampGetDayOfMonthZeroBasedscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfMonthZeroBased()., |
| 195 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetDayOfWeekscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetDayOfWeek.: timestampGetDayOfWeekscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfWeek()., |
| 196 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetHoursscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetHours.: timestampGetHoursscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetHours()., |
| 197 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetMinutesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetMinutes.: timestampGetMinutesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetMinutes()., |
| 198 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetSecondsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetSeconds.: timestampGetSecondsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetSeconds()., |
| 199 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetMillisecondsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetMilliseconds.: timestampGetMillisecondsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetMilliseconds().} |
| 200 | |
| 201 | timestampOneArgOverloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampOneArgOverloads. = map[string]func(timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#, refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#{ |
| 202 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetFullYearscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetFullYear.: timestampGetFullYearWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetFullYearWithTz()., |
| 203 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetMonthscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetMonth.: timestampGetMonthWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetMonthWithTz()., |
| 204 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetDayOfYearscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetDayOfYear.: timestampGetDayOfYearWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfYearWithTz()., |
| 205 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetDatescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetDate.: timestampGetDayOfMonthOneBasedWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfMonthOneBasedWithTz()., |
| 206 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetDayOfMonthscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetDayOfMonth.: timestampGetDayOfMonthZeroBasedWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfMonthZeroBasedWithTz()., |
| 207 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetDayOfWeekscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetDayOfWeek.: timestampGetDayOfWeekWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfWeekWithTz()., |
| 208 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetHoursscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetHours.: timestampGetHoursWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetHoursWithTz()., |
| 209 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetMinutesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetMinutes.: timestampGetMinutesWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetMinutesWithTz()., |
| 210 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetSecondsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetSeconds.: timestampGetSecondsWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetSecondsWithTz()., |
| 211 | overloadsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/.TimeGetMillisecondsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/overloads`/TimeGetMilliseconds.: timestampGetMillisecondsWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetMillisecondsWithTz().} |
| 212 | ) |
| 213 | |
| 214 | type timestampVisitorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampVisitor# func(timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# |
| 215 | |
| 216 | func timestampGetFullYearscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetFullYear().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 217 | return Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(t.Yearscip-go gomod github.com/golang/go/src go1.23.0 time/Time#Year().()) |
| 218 | } |
| 219 | func timestampGetMonthscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetMonth().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 220 | // CEL spec indicates that the month should be 0-based, but the Time value |
| 221 | // for Month() is 1-based. |
| 222 | return Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(t.Monthscip-go gomod github.com/golang/go/src go1.23.0 time/Time#Month().() - 1) |
| 223 | } |
| 224 | func timestampGetDayOfYearscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfYear().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 225 | return Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(t.YearDayscip-go gomod github.com/golang/go/src go1.23.0 time/Time#YearDay().() - 1) |
| 226 | } |
| 227 | func timestampGetDayOfMonthZeroBasedscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfMonthZeroBased().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 228 | return Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(t.Dayscip-go gomod github.com/golang/go/src go1.23.0 time/Time#Day().() - 1) |
| 229 | } |
| 230 | func timestampGetDayOfMonthOneBasedscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfMonthOneBased().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 231 | return Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(t.Dayscip-go gomod github.com/golang/go/src go1.23.0 time/Time#Day().()) |
| 232 | } |
| 233 | func timestampGetDayOfWeekscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfWeek().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 234 | return Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(t.Weekdayscip-go gomod github.com/golang/go/src go1.23.0 time/Time#Weekday().()) |
| 235 | } |
| 236 | func timestampGetHoursscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetHours().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 237 | return Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(t.Hourscip-go gomod github.com/golang/go/src go1.23.0 time/Time#Hour().()) |
| 238 | } |
| 239 | func timestampGetMinutesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetMinutes().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 240 | return Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(t.Minutescip-go gomod github.com/golang/go/src go1.23.0 time/Time#Minute().()) |
| 241 | } |
| 242 | func timestampGetSecondsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetSeconds().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 243 | return Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(t.Secondscip-go gomod github.com/golang/go/src go1.23.0 time/Time#Second().()) |
| 244 | } |
| 245 | func timestampGetMillisecondsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetMilliseconds().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 246 | return Intscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/Int#(t.Nanosecondscip-go gomod github.com/golang/go/src go1.23.0 time/Time#Nanosecond().() / 1000000) |
| 247 | } |
| 248 | |
| 249 | func timestampGetFullYearWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetFullYearWithTz().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#, tz refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 250 | return timeZonescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timeZone().(tz, timestampGetFullYearscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetFullYear().)(t) |
| 251 | } |
| 252 | func timestampGetMonthWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetMonthWithTz().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#, tz refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 253 | return timeZonescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timeZone().(tz, timestampGetMonthscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetMonth().)(t) |
| 254 | } |
| 255 | func timestampGetDayOfYearWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfYearWithTz().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#, tz refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 256 | return timeZonescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timeZone().(tz, timestampGetDayOfYearscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfYear().)(t) |
| 257 | } |
| 258 | func timestampGetDayOfMonthZeroBasedWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfMonthZeroBasedWithTz().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#, tz refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 259 | return timeZonescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timeZone().(tz, timestampGetDayOfMonthZeroBasedscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfMonthZeroBased().)(t) |
| 260 | } |
| 261 | func timestampGetDayOfMonthOneBasedWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfMonthOneBasedWithTz().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#, tz refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 262 | return timeZonescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timeZone().(tz, timestampGetDayOfMonthOneBasedscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfMonthOneBased().)(t) |
| 263 | } |
| 264 | func timestampGetDayOfWeekWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfWeekWithTz().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#, tz refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 265 | return timeZonescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timeZone().(tz, timestampGetDayOfWeekscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetDayOfWeek().)(t) |
| 266 | } |
| 267 | func timestampGetHoursWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetHoursWithTz().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#, tz refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 268 | return timeZonescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timeZone().(tz, timestampGetHoursscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetHours().)(t) |
| 269 | } |
| 270 | func timestampGetMinutesWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetMinutesWithTz().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#, tz refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 271 | return timeZonescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timeZone().(tz, timestampGetMinutesscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetMinutes().)(t) |
| 272 | } |
| 273 | func timestampGetSecondsWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetSecondsWithTz().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#, tz refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 274 | return timeZonescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timeZone().(tz, timestampGetSecondsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetSeconds().)(t) |
| 275 | } |
| 276 | func timestampGetMillisecondsWithTzscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetMillisecondsWithTz().(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#, tz refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 277 | return timeZonescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timeZone().(tz, timestampGetMillisecondsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampGetMilliseconds().)(t) |
| 278 | } |
| 279 | |
| 280 | func timeZonescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timeZone().(tz refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#, visitor timestampVisitorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampVisitor#) timestampVisitorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/timestampVisitor# { |
| 281 | return func(t timescip-go gomod github.com/golang/go/src go1.23.0 time/.Timescip-go gomod github.com/golang/go/src go1.23.0 time/Time#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# { |
| 282 | if StringTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/StringType. != tz.Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Type.() { |
| 283 | return MaybeNoSuchOverloadErrscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/MaybeNoSuchOverloadErr().(tz) |
| 284 | } |
| 285 | val := string(tz.(Stringscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/String#)) |
| 286 | ind := stringsscip-go gomod github.com/golang/go/src go1.23.0 strings/.Indexscip-go gomod github.com/golang/go/src go1.23.0 strings/Index().(val, ":") |
| 287 | if ind == -1 { |
| 288 | loc, err := timescip-go gomod github.com/golang/go/src go1.23.0 time/.LoadLocationscip-go gomod github.com/golang/go/src go1.23.0 time/LoadLocation().(val) |
| 289 | if err != nil { |
| 290 | return WrapErrscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/WrapErr().(err) |
| 291 | } |
| 292 | return visitor(t.Inscip-go gomod github.com/golang/go/src go1.23.0 time/Time#In().(loc)) |
| 293 | } |
| 294 | |
| 295 | // If the input is not the name of a timezone (for example, 'US/Central'), it should be a numerical offset from UTC |
| 296 | // in the format ^(+|-)(0[0-9]|1[0-4]):[0-5][0-9]$. The numerical input is parsed in terms of hours and minutes. |
| 297 | hr, err := strconvscip-go gomod github.com/golang/go/src go1.23.0 strconv/.Atoiscip-go gomod github.com/golang/go/src go1.23.0 strconv/Atoi().(string(val[0:ind])) |
| 298 | if err != nil { |
| 299 | return WrapErrscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/WrapErr().(err) |
| 300 | } |
| 301 | min, err := strconvscip-go gomod github.com/golang/go/src go1.23.0 strconv/.Atoiscip-go gomod github.com/golang/go/src go1.23.0 strconv/Atoi().(string(val[ind+1:])) |
| 302 | if err != nil { |
| 303 | return WrapErrscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types`/WrapErr().(err) |
| 304 | } |
| 305 | var offset int |
| 306 | if string(val[0]) == "-" { |
| 307 | offset = hr*60 - min |
| 308 | } else { |
| 309 | offset = hr*60 + min |
| 310 | } |
| 311 | secondsEastOfUTC := int((timescip-go gomod github.com/golang/go/src go1.23.0 time/.Durationscip-go gomod github.com/golang/go/src go1.23.0 time/Duration#(offset) * timescip-go gomod github.com/golang/go/src go1.23.0 time/.Minutescip-go gomod github.com/golang/go/src go1.23.0 time/Minute.).Secondsscip-go gomod github.com/golang/go/src go1.23.0 time/Duration#Seconds().()) |
| 312 | timezone := timescip-go gomod github.com/golang/go/src go1.23.0 time/.FixedZonescip-go gomod github.com/golang/go/src go1.23.0 time/FixedZone().("", secondsEastOfUTC) |
| 313 | return visitor(t.Inscip-go gomod github.com/golang/go/src go1.23.0 time/Time#In().(timezone)) |
| 314 | } |
| 315 | } |