Documentation
¶
Index ¶
- Constants
- func CallRPC[T any](ctx context.Context, tracer trace.Tracer, spanName string, serviceName string, ...) (T, *apierror.APIError)
- func MapProtoPageInfo(ctx context.Context, pi ProtoPageInfo) apiresource.PageInfo
- func MapProtoPageInfoForPath(canonicalPath string, pi ProtoPageInfo) apiresource.PageInfo
- func ParseDateString(s string) (time.Time, error)
- func ParseEndDateString(s string) (time.Time, error)
- func TimestampToTime(t *timestamppb.Timestamp) time.Time
- func TimestampToTimePtr(t *timestamppb.Timestamp) *time.Time
- type ProtoPageInfo
- type RPCOption
Constants ¶
const ( PasswordOperationTimeout = 15 * time.Second BillingOperationTimeout = 30 * time.Second // AnalyticsOperationTimeout covers the sweeps that read a whole collection — every contracted price, every invoiced line in a window — rather than one record. It sits just under the server's write timeout so the caller gets the API's own timeout error instead of a truncated response. AnalyticsOperationTimeout = 25 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func CallRPC ¶
func CallRPC[T any]( ctx context.Context, tracer trace.Tracer, spanName string, serviceName string, call func(ctx context.Context, opts ...grpc.CallOption) (T, error), opts ...RPCOption, ) (T, *apierror.APIError)
CallRPC executes a gRPC call with gateway-specific metadata (identity, idempotency key, API version, request ID) and standard boilerplate (tracing, timeout, error conversion, replayed detection).
Callers within the gateway continue using this function with the same signature — it delegates to rpc.CallRPC after preparing metadata.
func MapProtoPageInfo ¶
func MapProtoPageInfo(ctx context.Context, pi ProtoPageInfo) apiresource.PageInfo
MapProtoPageInfo converts any proto PageInfo into an API resource PageInfo, building relative pagination URLs from the current request URL stored in ctx.
func MapProtoPageInfoForPath ¶
func MapProtoPageInfoForPath(canonicalPath string, pi ProtoPageInfo) apiresource.PageInfo
MapProtoPageInfoForPath is like MapProtoPageInfo but uses an explicit canonical path instead of the current request URL. Use this for sub-object lists embedded in a parent response where the correct pagination URL must point to the sub-resource's own list endpoint. The caller is responsible for expanding any path parameters (e.g. "/v1/catalog/properties/"+propertyID+"/attributes"). Only the cursor query parameter is appended; the parent request's query string is intentionally excluded.
func ParseDateString ¶
ParseDateString parses a date string in YYYY-MM-DD format to a time.Time.
func ParseEndDateString ¶
Parses an inclusive end date (YYYY-MM-DD) as the last microsecond of that day, so rows created during the day still match `<= end`. Microseconds, not nanoseconds — DATETIME(6) stores no more.
func TimestampToTime ¶
func TimestampToTime(t *timestamppb.Timestamp) time.Time
TimestampToTime converts a protobuf timestamp to a time.Time.
func TimestampToTimePtr ¶
func TimestampToTimePtr(t *timestamppb.Timestamp) *time.Time
TimestampToTimePtr converts a protobuf timestamp to a time.Time pointer.