pop icon indicating copy to clipboard operation
pop copied to clipboard

Select using field with belongs_to association

Open kounelisagis opened this issue 6 years ago • 0 comments

Description

My structs are:

type Issue struct { ID uuid.UUID json:"id" db:"id" CreatedAt time.Time json:"created_at" db:"created_at" UpdatedAt time.Time json:"updated_at" db:"updated_at" Project Project json:"project" db:"-" belongs_to:"project" ProjectID uuid.UUID json:"project_id" db:"project_id" ... }

type Project struct { ID uuid.UUID json:"id" db:"id" CreatedAt time.Time json:"created_at" db:"created_at" UpdatedAt time.Time json:"updated_at" db:"updated_at" Language slices.String json:"language" db:"language" ... }

The problem is that I can't use a statement like this: Select * from issues where project.language = 'java' I'm already using Eager which loads associations. Is there any way to search using this associations?

Behavior

ERROR: missing FROM-clause entry for table "projects" at character 261

Info

Docker - Buffalo

kounelisagis avatar Aug 12 '19 09:08 kounelisagis