Help with my subscription variable is giving me never used error


Hey @mofodox, welcome to the community!

Is the error from the compiler on encore run, or is it your editor’s linter saying that?
If it’s only the linter, try running your application with encore run.
(Sometimes the linters get a bit confused, not specific to Encore.)

Looking at the code, you’re using sqldb.QueryRow when you are inserting data. You probably should be using sqldb.Exec.

Let me know if that doesn’t help!


Thank you for your response!

After I posted the thread, I tried some ways but this one works. Instead of me declaring an empty subcription, I include the properties with the params values as the subscription values.

Sample code:

type Subscription struct {
       Id int64
       Name string
       Price float32

func Create(ctx context.Context, params CreateParams) (*Subscription, error) {
      // ...
     subscription := Subscription{ Name: params.Name, Price: params.Price }

     // ...

With this I get what I wanted on the response :slight_smile:

1 Like