Execute the workflow from the Rest API

Hi mi am new to temporal and trying to execute the workflow definition from my Go Rest API. I developed my Rest api using GIN. now when i trying to create temporal client inside the rest api code its shows an error.

cannot use client.Dial((client.Options literal)) (value of type client.Client) as *gin.Context value in assignmentcompilerIncompatibleAssign

c, err := client.Dial(client.Options{})

Any suggestion/document or any reference.

The client is a heavyweight object and should be created once per process lifetime. So don’t create it inside the Rest API handlers.

Thanks Maxim… Is there any alternative to call workflow definition via Rest API without using the client?

Would it be possible as mentioned to create the client once and reuse it across your router functions? I’m not gin expert but seems doable.