Is it possible to use many to many between 3 models?

I have 3 models I want to join into a bridge table. The bridge table is "client_operator_role". 1. Operator

type Operator struct {
    gorm.Model
    Title             string            `gorm:"unique;not null" validate:"required,min=1,max=100"`
    Email             string            `gorm:"not null;unique" validate:"required,email"`
    Mobile            string            `gorm:"not null" validate:"required,min=7,max=15,numeric"`
    Last_online       time.Time         `gorm:"default:null" validate:"omitempty"`
    Last_ip           string            `gorm:"default:null" validate:"omitempty,ip"`
    Clients           []*Client         `gorm:"many2many:client_operators;"`
    Cli_ids           []string          `gorm:"-:all" validate:"omitempty,dive,numeric"` // placeholder field, wont be part of table
    GoadminCustomUser GoadminCustomUser `validate:"omitempty,dive"`
}
  1. Client
type Client struct {
    gorm.Model
    Name        string      `gorm:"unique;not null" validate:"required,min=1,max=30"`
    Kyc_status  string      `gorm:"not null" validate:"required,min=1,max=30"`
    Kyc_remarks string      `gorm:"default:null" validate:"omitempty,min=0,max=200"`
    Operators   []*Operator `gorm:"many2many:client_operators;"`
    Op_ids      []string    `gorm:"-:all" validate:"omitempty,dive,numeric"` // placeholder field, wont be part of table
    Users       []User
}
  1. Role
type GoadminRole struct {
    ID        uint `gorm:"primaryKey"`
    Name      string
    Slug      string
    CreatedAt time.Time
    UpdatedAt time.Time
    Operators []*Operator `gorm:"many2many:client_operator;"`
}

Gorm docs state many2many is only for 2 models. Is there a workaround to join these three?

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: rayjanoka

looking for this as well