Use a generic type parameter for retry func in overload code example

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Go Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      The executeWithRetries func in the examples for how to handle "SystemOverloadError" labels currently returns any, error. However, it's significantly more ergonomic to return T, error to preserve type information.

      E.g.

      func executeWithRetries[T any](
      	ctx context.Context, maxAttempts int,
      	fn func(ctx context.Context) (T, error),
      ) (T, error) {
      

      Definition of done

      • Update the "executeWithRetries" func to use a generic type param for the return type.

      Pitfalls

            Assignee:
            Unassigned
            Reporter:
            Matt Dale
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: